Skip to content
Snippets Groups Projects
Commit cc59b5cf authored by dj44vuri's avatar dj44vuri
Browse files

small changes and test added

parent fe964b8e
No related branches found
No related tags found
No related merge requests found
...@@ -75,10 +75,10 @@ as.data.frame(designf) ...@@ -75,10 +75,10 @@ as.data.frame(designf)
# Extract alt as the alternative identifier # Extract alt as the alternative identifier
alt = sub(".*\\.", "", row_id) alt = sub(".*\\.", "", row_id)
) %>% ) %>%
dplyr::select(-row_id) %>% # Drop the original row_id dplyr::select(-"row_id") %>% # Drop the original row_id
tidyr::pivot_wider( tidyr::pivot_wider(
id_cols = "Choice.situation", # Group by Choice.situation id_cols = "Choice.situation", # Group by Choice.situation
names_from = alt, # Use alt to create column suffixes names_from = "alt", # Use alt to create column suffixes
values_from = -c("Choice.situation", "alt"), # Values from other columns values_from = -c("Choice.situation", "alt"), # Values from other columns
names_glue = "{alt}.{.value}" # Custom naming convention names_glue = "{alt}.{.value}" # Custom naming convention
) )
......
...@@ -84,3 +84,17 @@ design_path <- system.file("extdata","ValuGaps", "des1.RDS" ,package = "simulate ...@@ -84,3 +84,17 @@ design_path <- system.file("extdata","ValuGaps", "des1.RDS" ,package = "simulate
test_that("all is correct with full spdesign objects", { test_that("all is correct with full spdesign objects", {
expect_no_error(readdesign(design = design_path, designtype = "spdesign")) expect_no_error(readdesign(design = design_path, designtype = "spdesign"))
}) })
### Tests for idefix
design_idefix <- system.file("extdata","Idefix_designs", "test_design2.RDS" ,package = "simulateDCE")
test_that("all is correct with full idefix objects", {
expect_no_error(readdesign(design_idefix, designtype = "idefix"))
})
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment