From 5d92333b37daeb66dde85290edb253d8a068c52d Mon Sep 17 00:00:00 2001 From: Jannik Date: Wed, 9 Aug 2023 08:32:39 +0200 Subject: [PATCH] removing example for internal function --- DESCRIPTION | 4 ++-- R/extract_algebra_elements.R | 5 ----- README.Rmd | 3 +-- README.md | 32 +++++++++++++-------------- man/extract_algebra_elements.Rd | 6 ----- tests/testthat/test-extract_algebra.R | 8 +++++++ 6 files changed, 27 insertions(+), 31 deletions(-) create mode 100644 tests/testthat/test-extract_algebra.R diff --git a/DESCRIPTION b/DESCRIPTION index 90ebfe4..5878348 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: mxsem Type: Package -Title: Specify 'OpenMx' Models with a 'lavaan'-Like Syntax -Version: 0.0.3 +Title: Specify 'OpenMx' Models with a 'lavaan'-Style Syntax +Version: 0.0.4 Date: 2023-07-12 Authors@R: c(person(given = "Jannik H.", family = "Orzek", role = c("aut", "cre", "cph"), diff --git a/R/extract_algebra_elements.R b/R/extract_algebra_elements.R index ed886eb..6a6518d 100644 --- a/R/extract_algebra_elements.R +++ b/R/extract_algebra_elements.R @@ -5,11 +5,6 @@ #' @param extracted used in recursive function calls; don't set this manually #' @return vector with names of variables and parameters used in the function call #' @keywords internal -#' @examples -#' library(mxsem) -#' simple_algebra <- mxAlgebraFromString("exp(b + c)", name = "a") -#' -#' mxsem:::extract_algebra_elements(simple_algebra@formula) extract_algebra_elements <- function(mxAlgebra_formula, extracted = c()){ for(i in 1:length(mxAlgebra_formula)){ diff --git a/README.Rmd b/README.Rmd index 2cf61cc..a9dd825 100644 --- a/README.Rmd +++ b/README.Rmd @@ -58,8 +58,7 @@ Because **mxsem** implements the syntax parser from scratch, it can extend the ## Citation Cite **OpenMx** (Boker et al., 2011) for the modeling and **lavaan** for the -syntax (Rosseel, 2012). **mxsem** itself is just a very small package and lets -**OpenMx** do all the heavy lifting. +syntax (Rosseel, 2012). To cite **mxsem**, check `citation("mxsem")`. ## Installation diff --git a/README.md b/README.md index e478a82..894c786 100644 --- a/README.md +++ b/README.md @@ -52,8 +52,8 @@ curly braces. ## Citation Cite **OpenMx** (Boker et al., 2011) for the modeling and **lavaan** for -the syntax (Rosseel, 2012). **mxsem** itself is just a very small -package and lets **OpenMx** do all the heavy lifting. +the syntax (Rosseel, 2012). To cite **mxsem**, check +`citation("mxsem")`. ## Installation @@ -159,8 +159,8 @@ Show summary #> AIC: 1528.9445 3178.945 3283.308 #> BIC: -287.9662 3273.962 3144.740 #> To get additional fit indices, see help(mxRefModels) - #> timestamp: 2023-08-03 11:27:39 - #> Wall clock time: 0.2723861 secs + #> timestamp: 2023-08-09 08:07:01 + #> Wall clock time: 0.3236761 secs #> optimizer: SLSQP #> OpenMx version number: 2.21.8 #> Need help? See help(mxSummary) @@ -252,8 +252,8 @@ Show summary #> AIC: 1607.0759 3257.076 3321.691 #> BIC: -223.7397 3338.188 3227.877 #> To get additional fit indices, see help(mxRefModels) - #> timestamp: 2023-08-03 11:27:40 - #> Wall clock time: 0.0548799 secs + #> timestamp: 2023-08-09 08:07:02 + #> Wall clock time: 0.053231 secs #> optimizer: SLSQP #> OpenMx version number: 2.21.8 #> Need help? See help(mxSummary) @@ -351,8 +351,8 @@ Show summary #> AIC: 821.2609 861.2609 863.7328 #> BIC: 795.2092 887.3126 855.7301 #> To get additional fit indices, see help(mxRefModels) - #> timestamp: 2023-08-03 11:27:42 - #> Wall clock time: 0.2586932 secs + #> timestamp: 2023-08-09 08:07:04 + #> Wall clock time: 0.2974899 secs #> optimizer: SLSQP #> OpenMx version number: 2.21.8 #> Need help? See help(mxSummary) @@ -454,8 +454,8 @@ Show summary #> AIC: 461.3822 515.3822 526.0151 #> BIC: 443.1460 567.4856 504.3206 #> To get additional fit indices, see help(mxRefModels) - #> timestamp: 2023-08-03 11:27:42 - #> Wall clock time: 0.03566003 secs + #> timestamp: 2023-08-09 08:07:04 + #> Wall clock time: 0.0394721 secs #> optimizer: SLSQP #> OpenMx version number: 2.21.8 #> Need help? See help(mxSummary) @@ -526,8 +526,8 @@ Show summary #> AIC: 461.3822 515.3822 526.0151 #> BIC: 443.1460 567.4856 504.3206 #> To get additional fit indices, see help(mxRefModels) - #> timestamp: 2023-08-03 11:27:42 - #> Wall clock time: 0.03693199 secs + #> timestamp: 2023-08-09 08:07:04 + #> Wall clock time: 0.03983593 secs #> optimizer: SLSQP #> OpenMx version number: 2.21.8 #> Need help? See help(mxSummary) @@ -598,8 +598,8 @@ Show summary #> AIC: 461.3822 515.3822 526.0151 #> BIC: 443.1460 567.4856 504.3206 #> To get additional fit indices, see help(mxRefModels) - #> timestamp: 2023-08-03 11:27:43 - #> Wall clock time: 0.03773284 secs + #> timestamp: 2023-08-09 08:07:05 + #> Wall clock time: 0.04041314 secs #> optimizer: SLSQP #> OpenMx version number: 2.21.8 #> Need help? See help(mxSummary) @@ -701,8 +701,8 @@ Show summary #> AIC: 1551.1683 3201.168 3265.784 #> BIC: -279.6473 3282.280 3171.970 #> To get additional fit indices, see help(mxRefModels) - #> timestamp: 2023-08-03 11:27:43 - #> Wall clock time: 0.09258008 secs + #> timestamp: 2023-08-09 08:07:05 + #> Wall clock time: 0.10127 secs #> optimizer: SLSQP #> OpenMx version number: 2.21.8 #> Need help? See help(mxSummary) diff --git a/man/extract_algebra_elements.Rd b/man/extract_algebra_elements.Rd index d0036ad..28b34c4 100644 --- a/man/extract_algebra_elements.Rd +++ b/man/extract_algebra_elements.Rd @@ -17,10 +17,4 @@ vector with names of variables and parameters used in the function call \description{ extract all variables/parameters from an mxAlgebra } -\examples{ -library(mxsem) -simple_algebra <- mxAlgebraFromString("exp(b + c)", name = "a") - -mxsem:::extract_algebra_elements(simple_algebra@formula) -} \keyword{internal} diff --git a/tests/testthat/test-extract_algebra.R b/tests/testthat/test-extract_algebra.R new file mode 100644 index 0000000..9927725 --- /dev/null +++ b/tests/testthat/test-extract_algebra.R @@ -0,0 +1,8 @@ +test_that("extracting algebra", { + library(mxsem) + simple_algebra <- mxAlgebraFromString("exp(b + c)", name = "a") + + alg <- mxsem:::extract_algebra_elements(simple_algebra@formula) + + testthat::expect_equal(alg, c("b", "c")) +})