diff --git a/R/set_survey.R b/R/set_survey.R index 9bbdac9..2bedfcb 100644 --- a/R/set_survey.R +++ b/R/set_survey.R @@ -90,6 +90,10 @@ set_survey = function(design, opts = "NCHS" , " (survey.design or svyrep.design) or a data.frame for an unweighted survey." , " Is: ", class(design)[1] )) + # get rid of non-`data.frame` classes (like tbl_df, tbl), which cause problems for some reason + assert_that(is.data.frame(design$variables)) + design$variables %<>% as.data.frame() + if(inherits(design, "svyrep.design") && !isTRUE(attr(design, "prob_set"))) { assert_that(!("prob" %in% names(design)) , msg = "prob already exists") diff --git a/R/z_data.R b/R/z_data.R index efe3110..98b7640 100644 --- a/R/z_data.R +++ b/R/z_data.R @@ -7,7 +7,7 @@ #' `namcs2019sv_df` is a data frame. #' #' `namcs2019sv` is a survey object created from `namcs2019sv_df` -#' using `[survey::svydesign()]`. +#' using `survey::svydesign()`. #' #' @source #' * SAS data: diff --git a/docs/articles/Advanced-topics.html b/docs/articles/Advanced-topics.html index cb30201..742d0c2 100644 --- a/docs/articles/Advanced-topics.html +++ b/docs/articles/Advanced-topics.html @@ -498,8 +498,9 @@

Data flowsaveRDS(). Normally, you probably don’t want to do this. Normally, the survey file (mysurvey.rds) should probably not be changed. @@ -523,7 +524,8 @@

Data flowset_survey(), those changes are lost, because set_survey() copies (2) -> (3). If those changes were important, you can just rerun the code -that created them.

+that created them. If you really need to go from (3) to (2), use +mysurvey = surveytable:::.load_survey().