Skip to content

Commit

Permalink
Merge pull request #12 from gnoblet/11-change-of-the-analysis-key-format
Browse files Browse the repository at this point in the history
Fixes #11
  • Loading branch information
gnoblet authored May 17, 2024
2 parents dcb84eb + cbe9b6f commit cf8c57c
Show file tree
Hide file tree
Showing 38 changed files with 106 additions and 106 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Description: Providing helpers to support a (quasi-)automated survey data analys
License: MIT + file LICENSE
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1
Imports:
dplyr (>= 1.1.0),
impactR.kobo,
Expand Down
2 changes: 1 addition & 1 deletion R/internals.R
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ are_in_set <- function(df, cols, set, main_message){


# Adds the analysis key to the results table from a svy_*() function
add_analysis_key <- function(results, group_key_name = "group_key", group_key_value_name = "group_key_value", group_key_sep = " ~/~ ", var_name = "var", var_value_name = "var_value", var_key_sep = " ~/~ ", overall_sep = " @/@ ", main_sep = " ~/~ ", var_to_value_sep = " %/% ") {
add_analysis_key <- function(results, group_key_name = "group_key", group_key_value_name = "group_key_value", group_key_sep = " -/- ", var_name = "var", var_value_name = "var_value", var_key_sep = " -/- ", overall_sep = " @/@ ", main_sep = " -/- ", var_to_value_sep = " %/% ") {


# Extract group values
Expand Down
2 changes: 1 addition & 1 deletion R/kobo_analysis.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#'
#' @export
#'
kobo_analysis <- function(design, analysis, vars, survey, choices = NULL, group = NULL, group_key_sep = " ~/~ ", label_survey = TRUE, label_choices = TRUE, na_rm = TRUE, vartype = "ci", level = 0.95, ratio_key_sep = " ~/~ ", choices_sep = "_"){
kobo_analysis <- function(design, analysis, vars, survey, choices = NULL, group = NULL, group_key_sep = " -/- ", label_survey = TRUE, label_choices = TRUE, na_rm = TRUE, vartype = "ci", level = 0.95, ratio_key_sep = " -/- ", choices_sep = "_"){


analysis_type <- c("mean", "median", "select_multiple", "select_one", "ratio")
Expand Down
2 changes: 1 addition & 1 deletion R/kobo_mean.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#' @return A character vector of select_one questions.
#'
#' @export
kobo_mean <- function(design, vars, survey, group = NULL, group_key_sep = " ~/~ ", label_survey = TRUE, na_rm = TRUE, vartype = "ci", level = 0.95){
kobo_mean <- function(design, vars, survey, group = NULL, group_key_sep = " -/- ", label_survey = TRUE, na_rm = TRUE, vartype = "ci", level = 0.95){


#------ Gather arguments
Expand Down
2 changes: 1 addition & 1 deletion R/kobo_mean_all.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#' @return A character vector of select_one questions.
#'
#' @export
kobo_mean_all <- function(design, survey, group = NULL, group_key_sep = " ~/~ ", label_survey = TRUE, na_rm = TRUE, vartype = "ci", level = 0.95){
kobo_mean_all <- function(design, survey, group = NULL, group_key_sep = " -/- ", label_survey = TRUE, na_rm = TRUE, vartype = "ci", level = 0.95){

suppressWarnings(
num_vars <- c(
Expand Down
2 changes: 1 addition & 1 deletion R/kobo_median.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#' @return A character vector of select_one questions.
#'
#' @export
kobo_median <- function(design, vars, survey, group = NULL, group_key_sep = " ~/~ ", label_survey = TRUE, na_rm = TRUE, vartype = "ci", level = 0.95){
kobo_median <- function(design, vars, survey, group = NULL, group_key_sep = " -/- ", label_survey = TRUE, na_rm = TRUE, vartype = "ci", level = 0.95){


#------ Gather arguments
Expand Down
2 changes: 1 addition & 1 deletion R/kobo_median_all.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#' @return A character vector of select_one questions.
#'
#' @export
kobo_median_all <- function(design, survey, group = NULL, group_key_sep = " ~/~ ", label_survey = TRUE, na_rm = TRUE, vartype = "ci", level = 0.95){
kobo_median_all <- function(design, survey, group = NULL, group_key_sep = " -/- ", label_survey = TRUE, na_rm = TRUE, vartype = "ci", level = 0.95){

suppressWarnings(num_vars <- c(
impactR.kobo::get_survey_decimal(survey),
Expand Down
2 changes: 1 addition & 1 deletion R/kobo_ratio.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#' @return A character vector of select_one questions.
#'
#' @export
kobo_ratio <- function(design, nums, denoms, ratio_key_sep = " ~/~ ", survey, group = NULL, group_key_sep = " ~/~ ", label_survey = TRUE, na_rm = TRUE, vartype = "ci", level = 0.95){
kobo_ratio <- function(design, nums, denoms, ratio_key_sep = " -/- ", survey, group = NULL, group_key_sep = " ~/~ ", label_survey = TRUE, na_rm = TRUE, vartype = "ci", level = 0.95){


#------ Gather arguments
Expand Down
2 changes: 1 addition & 1 deletion R/kobo_select_multiple.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#' @return A character vector of select_one questions.
#'
#' @export
kobo_select_multiple <- function(design, vars, survey, choices = NULL, choices_sep = "_", group = NULL, group_key_sep = " ~/~ ", label_survey = TRUE, label_choices = TRUE, na_rm = TRUE, vartype = "ci", level = 0.95){
kobo_select_multiple <- function(design, vars, survey, choices = NULL, choices_sep = "_", group = NULL, group_key_sep = " -/- ", label_survey = TRUE, label_choices = TRUE, na_rm = TRUE, vartype = "ci", level = 0.95){

#------ Check

Expand Down
2 changes: 1 addition & 1 deletion R/kobo_select_multiple_all.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#' @return A character vector of select_one questions.
#'
#' @export
kobo_select_multiple_all <- function(design, survey, choices, group = NULL, group_key_sep = " ~/~ ", choices_sep = "_", label_survey = TRUE, label_choices = TRUE, na_rm = TRUE, vartype = "ci", level = 0.95){
kobo_select_multiple_all <- function(design, survey, choices, group = NULL, group_key_sep = " -/- ", choices_sep = "_", label_survey = TRUE, label_choices = TRUE, na_rm = TRUE, vartype = "ci", level = 0.95){

select_multiples <- impactR.kobo::get_survey_select_multiple(survey)

Expand Down
2 changes: 1 addition & 1 deletion R/kobo_select_one.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#' @return A character vector of select_one questions.
#'
#' @export
kobo_select_one <- function(design, vars, survey, choices = NULL, group = NULL, group_key_sep = " ~/~ ", label_survey = TRUE, na_rm = TRUE, vartype = "ci", level = 0.95){
kobo_select_one <- function(design, vars, survey, choices = NULL, group = NULL, group_key_sep = " -/- ", label_survey = TRUE, na_rm = TRUE, vartype = "ci", level = 0.95){


#------ Gather arguments
Expand Down
2 changes: 1 addition & 1 deletion R/kobo_select_one_all.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#' @return A character vector of select_one questions.
#'
#' @export
kobo_select_one_all <- function(design, survey, choices = NULL, group = NULL, group_key_sep = " ~/~ ", label_survey = TRUE, na_rm = TRUE, vartype = "ci", level = 0.95){
kobo_select_one_all <- function(design, survey, choices = NULL, group = NULL, group_key_sep = " -/- ", label_survey = TRUE, na_rm = TRUE, vartype = "ci", level = 0.95){

select_ones <- impactR.kobo::get_survey_select_one(survey)

Expand Down
2 changes: 1 addition & 1 deletion R/svy_analysis.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#'
#' @export
#'
svy_analysis <- function(design, analysis, vars, group = NULL, group_key_sep = " ~/~ ", na_rm = TRUE, vartype = "ci", level = 0.95, ratio_key_sep = " ~/~ ", interact_key_sep = " ~/~ ", quantiles = c(0.25, 0.5, 0.75), ak = TRUE, ak_overall_sep = " @/@ ", ak_main_sep = " ~/~", ak_var_to_value_sep = " %/% ", ...){
svy_analysis <- function(design, analysis, vars, group = NULL, group_key_sep = " -/- ", na_rm = TRUE, vartype = "ci", level = 0.95, ratio_key_sep = " ~/~ ", interact_key_sep = " -/- ", quantiles = c(0.25, 0.5, 0.75), ak = TRUE, ak_overall_sep = " @/@ ", ak_main_sep = " -/-", ak_var_to_value_sep = " %/% ", ...){


analysis_type <- c("mean", "median", "proportion", "quantile", "ratio", "interact")
Expand Down
2 changes: 1 addition & 1 deletion R/svy_interact.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#' @return A survey-summarized-mean data frame
#'
#' @export
svy_interact <- function(design, interact, interact_key_sep = " ~/~ ", group = NULL, group_key_sep = " ~/~ ", unnest_interaction = TRUE, na_rm = TRUE, vartype = "ci", level = 0.95, ak = TRUE, ak_overall_sep = " @/@ ", ak_main_sep = " ~/~ ", ak_var_to_value_sep = " %/% ", ...){
svy_interact <- function(design, interact, interact_key_sep = " -/- ", group = NULL, group_key_sep = " -/- ", unnest_interaction = TRUE, na_rm = TRUE, vartype = "ci", level = 0.95, ak = TRUE, ak_overall_sep = " @/@ ", ak_main_sep = " -/- ", ak_var_to_value_sep = " %/% ", ...){

#------ Gather arguments

Expand Down
2 changes: 1 addition & 1 deletion R/svy_mean.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#' @return A survey-summarized-mean data frame
#'
#' @export
svy_mean <- function(design, vars, group = NULL, group_key_sep = " ~/~ ", na_rm = TRUE, vartype = "ci", level = 0.95, ak = TRUE, ak_overall_sep = " @/@ ", ak_main_sep = " ~/~ ", ak_var_to_value_sep = " %/% ", ...){
svy_mean <- function(design, vars, group = NULL, group_key_sep = " -/- ", na_rm = TRUE, vartype = "ci", level = 0.95, ak = TRUE, ak_overall_sep = " @/@ ", ak_main_sep = " -/- ", ak_var_to_value_sep = " %/% ", ...){

#------ Gather arguments

Expand Down
2 changes: 1 addition & 1 deletion R/svy_median.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#' @return A survey-summarized-median data frame
#'
#' @export
svy_median <- function(design, vars, group = NULL, group_key_sep = " ~/~ ", na_rm = TRUE, vartype = "ci", level = 0.95, ak = TRUE, ak_overall_sep = " @/@ ", ak_main_sep = " ~/~ ", ak_var_to_value_sep = " %/% ", ...){
svy_median <- function(design, vars, group = NULL, group_key_sep = " -/- ", na_rm = TRUE, vartype = "ci", level = 0.95, ak = TRUE, ak_overall_sep = " @/@ ", ak_main_sep = " -/- ", ak_var_to_value_sep = " %/% ", ...){

#------ Gather arguments

Expand Down
2 changes: 1 addition & 1 deletion R/svy_proportion.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#' @return A survey-summarized-proportion data frame
#'
#' @export
svy_proportion <- function(design, vars, group = NULL, group_key_sep = " ~/~ ", na_rm = TRUE, vartype = "ci", level = 0.95, ak = TRUE, ak_overall_sep = " @/@ ", ak_main_sep = " ~/~ ", ak_var_to_value_sep = " %/% ", ...){
svy_proportion <- function(design, vars, group = NULL, group_key_sep = " -/- ", na_rm = TRUE, vartype = "ci", level = 0.95, ak = TRUE, ak_overall_sep = " @/@ ", ak_main_sep = " -/- ", ak_var_to_value_sep = " %/% ", ...){

#------ Gather arguments

Expand Down
2 changes: 1 addition & 1 deletion R/svy_quantile.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#' @return A survey-summarized-mean data frame
#'
#' @export
svy_quantile <- function(design, vars, quantiles = c(0.25, 0.5, 0.75), group = NULL, group_key_sep = " ~/~ ", na_rm = TRUE, vartype = "ci", level = 0.95, ...){
svy_quantile <- function(design, vars, quantiles = c(0.25, 0.5, 0.75), group = NULL, group_key_sep = " -/- ", na_rm = TRUE, vartype = "ci", level = 0.95, ...){


#------ Gather arguments
Expand Down
2 changes: 1 addition & 1 deletion R/svy_ratio.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#' @return A survey-summarized-ratio data frame
#'
#' @export
svy_ratio <- function(design, nums, denoms, ratio_key_sep = " ~/~ ", group = NULL, group_key_sep = " ~/~ ", na_rm = TRUE, vartype = "ci", level = 0.95, ak = TRUE, ak_overall_sep = " @/@ ", ak_main_sep = " ~/~ ", ak_var_to_value_sep = " %/% ", ...){
svy_ratio <- function(design, nums, denoms, ratio_key_sep = " -/- ", group = NULL, group_key_sep = " -/- ", na_rm = TRUE, vartype = "ci", level = 0.95, ak = TRUE, ak_overall_sep = " @/@ ", ak_main_sep = " -/- ", ak_var_to_value_sep = " %/% ", ...){

#------ Gather arguments

Expand Down
12 changes: 6 additions & 6 deletions man/auto_kobo_analysis.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions man/kobo_analysis.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions man/kobo_analysis_from_dap.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions man/kobo_mean.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions man/kobo_mean_all.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions man/kobo_median.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions man/kobo_median_all.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit cf8c57c

Please sign in to comment.