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

createset function updated and first test for createset

parent 615dde59
Branches
No related tags found
1 merge request!1functions generally improved and made packagelike, quicktexregapollo added...
* text=auto
*.R text eol=lf
......@@ -44,10 +44,12 @@ createSets <- function(.data, choice, attributes , uniquerow, prefix="a") {
stop("The columns choice, uniquerow, and attributes should not have missing values.")
}
sets <- .data %>%
dplyr::select({{ attributes }}, {{ choice }}, {{ uniquerow }} ) %>%
dplyr::group_by(!!rlang::sym(uniquerow), !!rlang::sym(choice)) %>%
dplyr::add_count() %>% dplyr::ungroup %>%
dplyr::add_count() %>% dplyr::ungroup() %>%
dplyr::group_by(!!rlang::sym(uniquerow)) %>%
dplyr::distinct(n, .keep_all=TRUE) %>%
dplyr::mutate(perc = round((n / sum(n) * 100))) %>%
......
Source diff could not be displayed: it is too large. Options to address this: view the blob.
rm(list = ls())
devtools::load_all()
model_path <- system.file("extdata", "csasimdata.csv", package = "choiceTools")
data <- read.csv(model_path)
sets <- createSets(data,choice = "CHOICE", uniquerow = "Choice_situation" ,attributes =c("alt1_x1" , "alt2_x1", "alt1_x2" , "alt2_x2") ,prefix = "alt" )
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment