diff --git a/.Rbuildignore b/.Rbuildignore index b49d6fd2bfa6f93457b98ab6fd0e47d1e6e0a941..350519f86a6a736b713256d5438cefc6944050d8 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -1,3 +1,4 @@ ^DCEsim\.Rproj$ ^\.Rproj\.user$ ^LICENSE\.md$ +^data-raw$ diff --git a/R/globals.R b/R/globals.R new file mode 100644 index 0000000000000000000000000000000000000000..94a876df8de89bdf81829990f246d824a2a98f53 --- /dev/null +++ b/R/globals.R @@ -0,0 +1 @@ +utils::globalVariables(c("designfile", "destype", "Choice.situation", "Design")) diff --git a/R/readdesign.R b/R/readdesign.R index b0f58bcad13e606b3a3dfe210e213a385232376a..1a38b6c571774758b8ab5488727748b8a856d441 100644 --- a/R/readdesign.R +++ b/R/readdesign.R @@ -10,8 +10,16 @@ #' @return a dataframe #' @export #' -#' @examples \dontrun{readdesign("Projects/test/Designs/firstdesign.ngd", "ngene")} +#' @examples library(simulateDCE) +#' mydesign <-readdesign( +#' system.file("extdata","agora", "altscf_eff.ngd" ,package = "simulateDCE"), +#' "ngene") #' +#' print(mydesign) +#' + + + readdesign <- function(design = designfile, designtype = destype) { design <- switch(designtype, "ngene" = readr::read_delim(design, @@ -24,7 +32,7 @@ readdesign <- function(design = designfile, designtype = destype) { dplyr::filter(!is.na(Choice.situation)), "spdesign" = as.data.frame(readRDS(design)) |> dplyr::mutate(Choice.situation = 1:dplyr::n()) |> - dplyr::rename_with(~ stringr::str_replace(., pattern = "_", "\\."), everything()), + dplyr::rename_with(~ stringr::str_replace(., pattern = "_", "\\."), tidyr::everything()), stop("Invalid value for design. Please provide either 'ngene' or 'spdesign'.") ) } diff --git a/inst/extdata/agora/altscf_eff.ngd b/inst/extdata/agora/altscf_eff.ngd new file mode 100644 index 0000000000000000000000000000000000000000..5cfe85c51731d8b61a92f737baf6bf523dffee4b --- /dev/null +++ b/inst/extdata/agora/altscf_eff.ngd @@ -0,0 +1,101 @@ +Design Choice situation alt1.b alt1.c alt1.d alt1.p alt2.b alt2.c alt2.d alt2.p Block +1 1 0 1 1 41 0 0 1 71 3 +1 2 0 0 0 83 0 0 1 71 2 +1 3 1 1 0 83 0 1 0 59 3 +1 4 0 1 0 35 0 0 0 53 1 +1 5 1 0 1 77 0 0 0 59 2 +1 6 1 0 0 47 0 1 0 41 3 +1 7 0 0 0 53 0 1 1 35 1 +1 8 0 0 1 47 0 1 0 41 1 +1 9 1 1 0 59 0 1 1 83 3 +1 10 0 0 1 41 1 0 0 47 1 +1 11 0 1 0 77 1 1 0 71 3 +1 12 1 0 1 35 0 0 0 53 2 +1 13 0 1 0 41 1 0 1 41 3 +1 14 1 0 0 59 1 1 0 83 1 +1 15 0 0 0 83 1 0 1 77 1 +1 16 1 1 0 47 1 1 1 35 2 +1 17 1 0 1 83 0 1 1 47 2 +1 18 1 0 1 53 1 0 1 77 3 +1 19 1 1 1 53 0 1 1 83 1 +1 20 0 1 1 77 1 1 0 65 2 +1 21 1 0 0 53 1 0 0 65 2 +1 22 1 1 1 41 1 1 0 77 1 +1 23 0 0 0 59 1 1 1 35 2 +1 24 1 1 0 77 0 0 1 65 1 +1 25 0 1 1 35 0 0 1 71 3 +1 26 1 0 1 71 1 1 1 35 3 +1 27 0 1 1 71 0 1 1 47 1 +1 28 1 0 1 47 0 0 0 53 3 +1 29 0 1 1 71 1 0 0 59 2 +1 30 1 1 0 65 1 0 0 53 2 +1 31 0 0 1 65 1 1 1 83 2 +1 32 1 1 0 35 1 0 1 41 1 +1 33 0 0 0 65 0 0 0 59 3 +1 34 0 1 1 65 1 1 0 47 3 +1 35 1 1 1 71 1 0 1 65 1 +1 36 0 0 0 59 0 1 0 77 2 +|||||||||| +design +;alts = alt1*, alt2*, alt3 +;rows = 36 +;block = 3 +;eff = (mnl,d) +;rep = 1000 + +;con +;model: +U(alt1) = b1[-1.2] + b2[0.1] * B[0,1] + b3[0.4] * C[0,1] + b4[0.3] * D[0,1] + b5[0.02] * P[35:83:6]/ +U(alt2) = b6[-1.8] + b7[0.2]* B + b8[0.6] * C + b9[0.4] * D + b10[0.015]* P + +;formatTitle = 'Scenario <scenarionumber>' +;formatTableDimensions = 3, 6 +;formatTable: +1,1 = '' / +1,2 = 'Results' / +1,3 = 'Beratung' / +1,4 = 'Partner' / +1,5 = 'Kompensation' / +1,6 = 'Choice question&:' / +2,1 = 'alt1' / +2,2 = '<alt1.b>' / +2,3 = '<alt1.c>' / +2,4 = '<alt1.d>' / +2,5 = '<alt1.p>' / +2,6 = '' / +3,1 = 'alt2' / +3,2 = '<alt2.b>' / +3,3 = '<alt2.c>' / +3,4 = '<alt2.d>' / +3,5 = '<alt2.p>' / +3,6 = '' +;formatTableStyle: +1,1 = 'default' / +1,2 = 'headingattribute' / +1,3 = 'headingattribute' / +1,4 = 'headingattribute' / +1,5 = 'headingattribute' / +1,6 = 'headingattribute' / +2,1 = 'heading1' / +2,2 = 'body1' / +2,3 = 'body1' / +2,4 = 'body1' / +2,5 = 'body1' / +2,6 = 'choice1' / +3,1 = 'heading2' / +3,2 = 'body2' / +3,3 = 'body2' / +3,4 = 'body2' / +3,5 = 'body2' / +3,6 = 'choice2' +;formatStyleSheet = Default.css +;formatAttributes: +alt1.b(0=Results, 1=Action) / +alt1.c(0=Keine Beratung, 1=Mit Beratung) / +alt1.d(0=Keine Partner, 1=Mit Partner) / +alt1.p(35=#0, 41=#0, 47=#0, 53=#0, 59=#0, 65=#0, 71=#0, 77=#0, 83=#0) / +alt2.b(0=Results, 1=Action) / +alt2.c(0=Keine Beratung, 1=Mit Beratung) / +alt2.d(0=Keine Partner, 1=Mit Partner) / +alt2.p(35=#0, 41=#0, 47=#0, 53=#0, 59=#0, 65=#0, 71=#0, 77=#0, 83=#0) +$ \ No newline at end of file diff --git a/inst/extdata/agora/befficientdesign.ngd b/inst/extdata/agora/befficientdesign.ngd new file mode 100644 index 0000000000000000000000000000000000000000..e2c1f83761abba23ac4acbf0d3e789790c4c3618 --- /dev/null +++ b/inst/extdata/agora/befficientdesign.ngd @@ -0,0 +1,83 @@ +Design Choice situation alt1.b alt1.c alt1.d alt1.p alt2.b alt2.c alt2.d alt2.p Block +1 1 1 0 1 53 0 1 0 59 1 +1 2 1 1 0 71 0 0 1 47 2 +1 3 1 0 0 53 0 1 1 71 2 +1 4 0 0 0 77 1 1 1 35 2 +1 5 0 1 1 65 1 0 0 59 2 +1 6 0 1 0 35 1 0 1 83 2 +1 7 1 1 1 59 0 0 0 65 1 +1 8 1 1 1 35 0 0 0 83 2 +1 9 0 0 1 47 1 1 0 65 2 +1 10 0 0 1 41 1 1 0 77 1 +1 11 1 1 0 59 0 0 1 53 1 +1 12 1 0 1 71 0 1 0 47 1 +1 13 1 0 0 83 0 1 1 35 2 +1 14 1 0 0 47 0 1 1 71 1 +1 15 0 0 1 77 1 1 0 41 1 +1 16 0 1 0 41 1 0 1 77 1 +1 17 0 1 1 65 1 0 0 53 2 +1 18 0 1 0 83 1 0 1 41 1 +|||||||||| +design +;alts = alt1*, alt2*, alt3 +;rows = 18 +;block = 2 +;eff = (mnl,d,mean) +;rep = 1000 +;bdraws = halton(1000) +;con +;model: +U(alt1) = b1[(n,-1.2,0.1)] + b2[(n,0.1,0.02)] * B[0,1] + b3[(n,0.4,0.1)] * C[0,1] + b4[(n,0.3,0.1)] * D[0,1] + b5[(n,0.02,0.001)] * P[35:83:6]/ +U(alt2) = b6[(n,-1.4,0.1)] + b2 * B + b3 * C + b4 * D + b5 * P + +;formatTitle = 'Scenario <scenarionumber>' +;formatTableDimensions = 3, 6 +;formatTable: +1,1 = '' / +1,2 = 'Results' / +1,3 = 'Beratung' / +1,4 = 'Partner' / +1,5 = 'Kompensation' / +1,6 = 'Choice question&:' / +2,1 = 'alt1' / +2,2 = '<alt1.b>' / +2,3 = '<alt1.c>' / +2,4 = '<alt1.d>' / +2,5 = '<alt1.p>' / +2,6 = '' / +3,1 = 'alt2' / +3,2 = '<alt2.b>' / +3,3 = '<alt2.c>' / +3,4 = '<alt2.d>' / +3,5 = '<alt2.p>' / +3,6 = '' +;formatTableStyle: +1,1 = 'default' / +1,2 = 'headingattribute' / +1,3 = 'headingattribute' / +1,4 = 'headingattribute' / +1,5 = 'headingattribute' / +1,6 = 'headingattribute' / +2,1 = 'heading1' / +2,2 = 'body1' / +2,3 = 'body1' / +2,4 = 'body1' / +2,5 = 'body1' / +2,6 = 'choice1' / +3,1 = 'heading2' / +3,2 = 'body2' / +3,3 = 'body2' / +3,4 = 'body2' / +3,5 = 'body2' / +3,6 = 'choice2' +;formatStyleSheet = Default.css +;formatAttributes: +alt1.b(0=Results, 1=Action) / +alt1.c(0=Keine Beratung, 1=Mit Beratung) / +alt1.d(0=Keine Partner, 1=Mit Partner) / +alt1.p(35=#0, 41=#0, 47=#0, 53=#0, 59=#0, 65=#0, 71=#0, 77=#0, 83=#0) / +alt2.b(0=Results, 1=Action) / +alt2.c(0=Keine Beratung, 1=Mit Beratung) / +alt2.d(0=Keine Partner, 1=Mit Partner) / +alt2.p(35=#0, 41=#0, 47=#0, 53=#0, 59=#0, 65=#0, 71=#0, 77=#0, 83=#0) +$ \ No newline at end of file diff --git a/inst/extdata/agora/efficientdesign.ngd b/inst/extdata/agora/efficientdesign.ngd new file mode 100644 index 0000000000000000000000000000000000000000..8e8f4e386ceedc1911625121d1b973e1bdf41832 --- /dev/null +++ b/inst/extdata/agora/efficientdesign.ngd @@ -0,0 +1,83 @@ +Design Choice situation alt1.b alt1.c alt1.d alt1.p alt2.b alt2.c alt2.d alt2.p Block +1 1 0 1 1 65 1 0 0 59 2 +1 2 1 0 1 41 0 1 0 77 1 +1 3 1 1 0 41 0 0 1 77 2 +1 4 0 1 0 47 1 0 1 71 2 +1 5 0 1 0 35 1 0 1 83 1 +1 6 0 1 1 71 1 0 0 53 1 +1 7 0 0 1 71 1 1 0 41 1 +1 8 1 0 1 35 0 1 0 83 1 +1 9 1 1 1 53 0 0 0 65 2 +1 10 1 1 0 77 0 0 1 47 1 +1 11 1 1 0 65 0 0 1 47 2 +1 12 0 1 1 59 1 0 0 59 1 +1 13 1 0 0 53 0 1 1 65 2 +1 14 0 0 0 83 1 1 1 35 2 +1 15 1 0 0 83 0 1 1 35 1 +1 16 0 0 1 47 1 1 0 71 2 +1 17 1 0 1 77 0 1 0 41 2 +1 18 0 0 0 59 1 1 1 53 1 +|||||||||| +design +;alts = alt1*, alt2*, alt3 +;rows = 18 +;block = 2 +;eff = (mnl,d) +;rep = 1000 + +;con +;model: +U(alt1) = b1[-1.2] + b2[0.1] * B[0,1] + b3[0.4] * C[0,1] + b4[0.3] * D[0,1] + b5[0.02] * P[35:83:6]/ +U(alt2) = b6[-1.4] + b2 * B + b3 * C + b4 * D + b5 * P + +;formatTitle = 'Scenario <scenarionumber>' +;formatTableDimensions = 3, 6 +;formatTable: +1,1 = '' / +1,2 = 'Results' / +1,3 = 'Beratung' / +1,4 = 'Partner' / +1,5 = 'Kompensation' / +1,6 = 'Choice question&:' / +2,1 = 'alt1' / +2,2 = '<alt1.b>' / +2,3 = '<alt1.c>' / +2,4 = '<alt1.d>' / +2,5 = '<alt1.p>' / +2,6 = '' / +3,1 = 'alt2' / +3,2 = '<alt2.b>' / +3,3 = '<alt2.c>' / +3,4 = '<alt2.d>' / +3,5 = '<alt2.p>' / +3,6 = '' +;formatTableStyle: +1,1 = 'default' / +1,2 = 'headingattribute' / +1,3 = 'headingattribute' / +1,4 = 'headingattribute' / +1,5 = 'headingattribute' / +1,6 = 'headingattribute' / +2,1 = 'heading1' / +2,2 = 'body1' / +2,3 = 'body1' / +2,4 = 'body1' / +2,5 = 'body1' / +2,6 = 'choice1' / +3,1 = 'heading2' / +3,2 = 'body2' / +3,3 = 'body2' / +3,4 = 'body2' / +3,5 = 'body2' / +3,6 = 'choice2' +;formatStyleSheet = Default.css +;formatAttributes: +alt1.b(0=Results, 1=Action) / +alt1.c(0=Keine Beratung, 1=Mit Beratung) / +alt1.d(0=Keine Partner, 1=Mit Partner) / +alt1.p(35=#0, 41=#0, 47=#0, 53=#0, 59=#0, 65=#0, 71=#0, 77=#0, 83=#0) / +alt2.b(0=Results, 1=Action) / +alt2.c(0=Keine Beratung, 1=Mit Beratung) / +alt2.d(0=Keine Partner, 1=Mit Partner) / +alt2.p(35=#0, 41=#0, 47=#0, 53=#0, 59=#0, 65=#0, 71=#0, 77=#0, 83=#0) +$ \ No newline at end of file diff --git a/inst/extdata/agora/orthodesign.ngd b/inst/extdata/agora/orthodesign.ngd new file mode 100644 index 0000000000000000000000000000000000000000..c1a4c8d4566867b578b12cc01da3d97ee59af0e1 --- /dev/null +++ b/inst/extdata/agora/orthodesign.ngd @@ -0,0 +1,102 @@ +Design Choice situation alt1.b alt1.c alt1.d alt1.p alt2.b alt2.c alt2.d alt2.p Block +1 1 0 0 0 35 1 0 0 41 2 +1 2 0 0 0 35 0 1 1 41 2 +1 3 1 1 1 35 1 1 0 53 4 +1 4 1 1 1 35 0 1 0 47 1 +1 5 1 0 0 41 1 0 0 59 3 +1 6 1 0 0 41 0 0 0 35 4 +1 7 0 1 1 41 0 1 0 83 4 +1 8 0 1 1 41 1 0 1 59 2 +1 9 0 1 0 47 1 0 0 77 1 +1 10 1 1 0 47 0 0 1 77 2 +1 11 1 0 1 47 0 0 1 53 3 +1 12 0 0 1 47 0 1 1 41 2 +1 13 0 1 0 53 0 1 1 71 3 +1 14 1 1 0 53 0 1 1 59 3 +1 15 0 0 1 53 1 0 0 41 3 +1 16 1 0 1 53 0 0 0 65 1 +1 17 1 0 0 59 1 1 0 47 1 +1 18 0 1 0 59 1 0 0 71 4 +1 19 0 1 1 59 1 1 1 65 2 +1 20 1 0 1 59 0 0 1 47 1 +1 21 0 0 0 65 1 1 1 77 4 +1 22 1 1 0 65 1 1 1 35 4 +1 23 1 1 1 65 0 1 0 77 3 +1 24 0 0 1 65 0 0 0 35 1 +1 25 1 0 0 71 0 0 1 65 2 +1 26 1 1 0 71 1 1 0 65 1 +1 27 0 1 1 71 0 0 0 83 3 +1 28 0 0 1 71 1 0 1 47 3 +1 29 1 0 0 77 1 0 1 53 4 +1 30 0 1 0 77 1 1 1 83 1 +1 31 1 1 1 77 1 0 1 83 1 +1 32 0 0 1 77 0 1 0 53 4 +1 33 0 0 0 83 0 1 0 59 2 +1 34 0 1 0 83 1 1 1 35 2 +1 35 1 1 1 83 0 0 1 71 4 +1 36 1 0 1 83 1 1 0 71 3 +|||||||||| +design +;alts = alt1*, alt2*, alt3 +;rows = 36 +;block = 4 +;orth = seq + + +;con +;model: +U(alt1) = b1 + b2 * B[0,1] + b3 * C[0,1] + b4 * D[0,1] + b5 * P[35:83:6]/ +U(alt2) = b6[-1.4] + b2 * B + b3 * C + b4 * D + b5 * P + + +;formatTitle = 'Scenario <scenarionumber>' +;formatTableDimensions = 3, 6 +;formatTable: +1,1 = '' / +1,2 = 'Results' / +1,3 = 'Beratung' / +1,4 = 'Partner' / +1,5 = 'Kompensation' / +1,6 = 'Choice question&:' / +2,1 = 'alt1' / +2,2 = '<alt1.b>' / +2,3 = '<alt1.c>' / +2,4 = '<alt1.d>' / +2,5 = '<alt1.p>' / +2,6 = '' / +3,1 = 'alt2' / +3,2 = '<alt2.b>' / +3,3 = '<alt2.c>' / +3,4 = '<alt2.d>' / +3,5 = '<alt2.p>' / +3,6 = '' +;formatTableStyle: +1,1 = 'default' / +1,2 = 'headingattribute' / +1,3 = 'headingattribute' / +1,4 = 'headingattribute' / +1,5 = 'headingattribute' / +1,6 = 'headingattribute' / +2,1 = 'heading1' / +2,2 = 'body1' / +2,3 = 'body1' / +2,4 = 'body1' / +2,5 = 'body1' / +2,6 = 'choice1' / +3,1 = 'heading2' / +3,2 = 'body2' / +3,3 = 'body2' / +3,4 = 'body2' / +3,5 = 'body2' / +3,6 = 'choice2' +;formatStyleSheet = Default.css +;formatAttributes: +alt1.b(0=Results, 1=Action) / +alt1.c(0=Keine Beratung, 1=Mit Beratung) / +alt1.d(0=Keine Partner, 1=Mit Partner) / +alt1.p(35=#0, 41=#0, 47=#0, 53=#0, 59=#0, 65=#0, 71=#0, 77=#0, 83=#0) / +alt2.b(0=Results, 1=Action) / +alt2.c(0=Keine Beratung, 1=Mit Beratung) / +alt2.d(0=Keine Partner, 1=Mit Partner) / +alt2.p(35=#0, 41=#0, 47=#0, 53=#0, 59=#0, 65=#0, 71=#0, 77=#0, 83=#0) +$ \ No newline at end of file diff --git a/inst/extdata/agora/verybaddesign.ngd b/inst/extdata/agora/verybaddesign.ngd new file mode 100644 index 0000000000000000000000000000000000000000..dcaa6c0a98ffa7a4abd4b7deb47fe20209167a1e --- /dev/null +++ b/inst/extdata/agora/verybaddesign.ngd @@ -0,0 +1,83 @@ +Design Choice situation alt1.b alt1.c alt1.d alt1.p alt2.b alt2.c alt2.d alt2.p Block +1 1 0 1 1 53 0 0 0 65 2 +1 2 1 1 0 77 1 0 1 47 2 +1 3 0 1 0 71 0 0 1 41 1 +1 4 1 1 1 59 1 0 0 65 1 +1 5 0 0 0 65 1 1 1 59 2 +1 6 0 0 1 53 0 1 0 47 2 +1 7 0 0 1 47 1 1 0 71 2 +1 8 1 1 0 83 0 1 1 35 1 +1 9 0 0 1 47 1 0 0 53 1 +1 10 1 1 0 35 0 1 1 83 2 +1 11 0 1 0 65 1 1 1 59 1 +1 12 0 0 0 59 1 0 1 53 1 +1 13 1 1 0 77 1 0 1 41 2 +1 14 1 1 1 35 0 1 0 77 1 +1 15 0 0 1 41 1 1 0 71 1 +1 16 1 0 1 71 0 0 0 77 1 +1 17 1 0 1 83 0 1 0 35 2 +1 18 1 0 0 41 0 0 1 83 2 +|||||||||| +design +;alts = alt1*, alt2*, alt3 +;rows = 18 +;block = 2 +;eff = (mnl,d) +;rep = 1000 + +;model: +U(alt1) = b1[-10] + b2[9] * B[0,1] + b3[4] * C[0,1] + b4[0.3] * D[0,1] + b5[0.02] * P[35:83:6]/ +U(alt2) = b6[-1.4] + b2 * B + b3 * C + b4 * D + b5 * P + + +;formatTitle = 'Scenario <scenarionumber>' +;formatTableDimensions = 3, 6 +;formatTable: +1,1 = '' / +1,2 = 'Results' / +1,3 = 'Beratung' / +1,4 = 'Partner' / +1,5 = 'Kompensation' / +1,6 = 'Choice question&:' / +2,1 = 'alt1' / +2,2 = '<alt1.b>' / +2,3 = '<alt1.c>' / +2,4 = '<alt1.d>' / +2,5 = '<alt1.p>' / +2,6 = '' / +3,1 = 'alt2' / +3,2 = '<alt2.b>' / +3,3 = '<alt2.c>' / +3,4 = '<alt2.d>' / +3,5 = '<alt2.p>' / +3,6 = '' +;formatTableStyle: +1,1 = 'default' / +1,2 = 'headingattribute' / +1,3 = 'headingattribute' / +1,4 = 'headingattribute' / +1,5 = 'headingattribute' / +1,6 = 'headingattribute' / +2,1 = 'heading1' / +2,2 = 'body1' / +2,3 = 'body1' / +2,4 = 'body1' / +2,5 = 'body1' / +2,6 = 'choice1' / +3,1 = 'heading2' / +3,2 = 'body2' / +3,3 = 'body2' / +3,4 = 'body2' / +3,5 = 'body2' / +3,6 = 'choice2' +;formatStyleSheet = Default.css +;formatAttributes: +alt1.b(0=Results, 1=Action) / +alt1.c(0=Keine Beratung, 1=Mit Beratung) / +alt1.d(0=Keine Partner, 1=Mit Partner) / +alt1.p(35=#0, 41=#0, 47=#0, 53=#0, 59=#0, 65=#0, 71=#0, 77=#0, 83=#0) / +alt2.b(0=Results, 1=Action) / +alt2.c(0=Keine Beratung, 1=Mit Beratung) / +alt2.d(0=Keine Partner, 1=Mit Partner) / +alt2.p(35=#0, 41=#0, 47=#0, 53=#0, 59=#0, 65=#0, 71=#0, 77=#0, 83=#0) +$ \ No newline at end of file diff --git a/man/readdesign.Rd b/man/readdesign.Rd index 441e9968841c73c54b28a101eed25b4ff2ef28c3..b74ed46354627eecd771e72cd4a7d30282d846f0 100644 --- a/man/readdesign.Rd +++ b/man/readdesign.Rd @@ -18,6 +18,11 @@ a dataframe Creates a dataframe with the design. } \examples{ -\dontrun{readdesign("Projects/test/Designs/firstdesign.ngd", "ngene")} +library(simulateDCE) + mydesign <-readdesign( + system.file("extdata","agora", "altscf_eff.ngd" ,package = "simulateDCE"), + "ngene") + + print(mydesign) } diff --git a/tests/testthat/test-readdesign.R b/tests/testthat/test-readdesign.R new file mode 100644 index 0000000000000000000000000000000000000000..1e08d8a59c46b14c4b8677c93eee84920822e281 --- /dev/null +++ b/tests/testthat/test-readdesign.R @@ -0,0 +1,19 @@ +design_path <- system.file("extdata","agora", "altscf_eff.ngd" ,package = "simulateDCE") + + +test_that("wrong designtype", { + expect_error(readdesign(design = design_path, designtype = "ng"),"Invalid value for design. Please provide either 'ngene' or 'spdesign'.") +}) + + +test_that("file does not exist", { + expect_error(readdesign(design = system.file("data-raw/agora/alcf_eff.ngd", package = "simulateDCE"), designtype = "ngene"), + "does not exist in current working directory") +}) + +test_that("all is correct, but gives a warning", { + expect_warning(readdesign(design = design_path, designtype = "ngene"), + "One or more parsing issues, call ") +}) + +de