Skip to content

Commit

Permalink
comment
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Mar 7, 2024
1 parent 10ae6ba commit 31685dc
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions R/data_xtabulate.R
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,12 @@ print_html.dw_data_xtabulates <- function(x, big_mark = NULL, ...) {
# from the data.frame method, where `weights = weights`, and then,
# deparse(substitute(weights)) is "weights" (not "NULL" or "iris$not_found"),
# leading to an error when it's actually not (if "weights" is NULL)
# Example:
#> efc$weights <- abs(rnorm(n = nrow(efc), mean = 1, sd = 0.5))
# Here, efc$wweight is NULL
#> data_tabulate(efc$c172code, weights = efc$wweight)
# Here, wweight errors anyway, because object "wweight" is not found
#> data_tabulate(efc$c172code, weights = wweight)
grepl("$", weights_expression, fixed = TRUE) &&
# if all the above apply, weights must be NULL - only error in this case
is.null(weights)) {
Expand Down

0 comments on commit 31685dc

Please sign in to comment.