diff --git a/NAMESPACE b/NAMESPACE index 6835329..4b07034 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,6 +1,11 @@ # Generated by roxygen2: do not edit by hand +export(convert_params) export(estimate_mu_sd) export(estimate_parameters) +export(get_prop_table) +export(get_random_cp) export(get_responses) +export(pad_levels) +export(percentify) export(simulate_responses) diff --git a/R/helper_functions.R b/R/helper_functions.R index 46bb675..7efba97 100644 --- a/R/helper_functions.R +++ b/R/helper_functions.R @@ -18,6 +18,7 @@ var_skew_normal <- function(alpha) { #' Pad missing levels with zeros #' +#' @export #' @param pk proportions or probabilities across possible responses #' @param K number of response categories #' @return table of proportions across all possible responses @@ -30,6 +31,7 @@ pad_levels <- function(pk, K) { #' Get a table of proportions across each possible response #' +#' @export #' @param data a vector or array of responses #' @param K number of response categories #' @return table of proportions @@ -47,6 +49,7 @@ get_prop_table <- function(data, K) { #' Get random centered parameters `c(mu, sd, gamma1)` for testing #' +#' @export #' @return random centered parameters get_random_cp <- function() { mu <- stats::rnorm(1, 0, 1) @@ -58,6 +61,7 @@ get_random_cp <- function() { #' Return percentage for a given number #' +#' @export #' @param x number #' @param digits number of digits percentify <- function(x, digits=0) { diff --git a/R/simulation_of_responses.R b/R/simulation_of_responses.R index 6ee44cd..ed46a70 100644 --- a/R/simulation_of_responses.R +++ b/R/simulation_of_responses.R @@ -286,6 +286,7 @@ delta_skew_normal <- function(alpha) { #' Converts from centered parameters to direct parameters appearing in #' the skew-normal density. #' +#' @export #' @param cp centered parameters c(mu, sd, gamma1) #' @return direct parameters c(xi, omega, alpha) #' @seealso [sn::cp2dp] diff --git a/tests/testthat/discretization_testthat.R b/tests/discretization_testthat.R similarity index 97% rename from tests/testthat/discretization_testthat.R rename to tests/discretization_testthat.R index 5927470..4066f58 100644 --- a/tests/testthat/discretization_testthat.R +++ b/tests/discretization_testthat.R @@ -1,5 +1,5 @@ -library(testthat) -library(responsesR) +library("testthat") +library("responsesR") context("Testing optimal discretization") test_that("discretization of N(0,1) with 5 categories gives expected result", { diff --git a/tests/testthat/estimation_of_parameters_testthat.R b/tests/estimation_of_parameters_testthat.R similarity index 97% rename from tests/testthat/estimation_of_parameters_testthat.R rename to tests/estimation_of_parameters_testthat.R index 5266e3c..a9cd0a4 100644 --- a/tests/testthat/estimation_of_parameters_testthat.R +++ b/tests/estimation_of_parameters_testthat.R @@ -1,4 +1,5 @@ -library(testthat) +library("testthat") +library("responsesR") context("Testing estimation of parameters") set.seed(12345) diff --git a/tests/testthat/get_responses_testthat.R b/tests/get_responses_testthat.R similarity index 97% rename from tests/testthat/get_responses_testthat.R rename to tests/get_responses_testthat.R index 43118bb..317da8f 100644 --- a/tests/testthat/get_responses_testthat.R +++ b/tests/get_responses_testthat.R @@ -1,4 +1,5 @@ -library(testthat) +library("testthat") +library("responsesR") context("Testing get responses") set.seed(12345) diff --git a/tests/testthat/sn_univariate_testthat.R b/tests/sn_univariate_testthat.R similarity index 87% rename from tests/testthat/sn_univariate_testthat.R rename to tests/sn_univariate_testthat.R index db2493b..fe85d35 100644 --- a/tests/testthat/sn_univariate_testthat.R +++ b/tests/sn_univariate_testthat.R @@ -1,7 +1,6 @@ -library(testthat) +library("testthat") +library("responsesR") context("Testing univariate skew-normal functions") -source("helper_functions.R") -source("simulation_of_responses.R") # parameter conversion test test_that("convert_params gives the same results as sn::cp2dp", {