gergness / srvyr

R package to add 'dplyr'-like Syntax for Summary Statistics of Survey Data
209 stars 27 forks source link

Trying to get srvyr::reframe to work #155

Closed gergness closed 1 year ago

gergness commented 1 year ago

dplyr behavior is confusing, I don't see anywhere that I'm calling summarise(), but get this warning message:

suppressPackageStartupMessages(library(srvyr))
data(api, package = "survey")

dstrata <- apistrat %>%
  as_survey_design(strata = stype, weights = pw)

dstrata %>%
  reframe(
    x = unweighted(quantile(api99, c(0.05, 0.5, 0.95))),
  )
#> Warning: There was 1 warning in `dplyr::reframe()`.
#> ℹ In argument: `x = unweighted(quantile(api99, c(0.05, 0.5, 0.95)))`.
#> Caused by warning:
#> ! Returning more (or less) than 1 row per `summarise()` group was deprecated in
#>   dplyr 1.1.0.
#> ℹ Please use `reframe()` instead.
#> ℹ When switching from `summarise()` to `reframe()`, remember that `reframe()`
#>   always returns an ungrouped data frame and adjust accordingly.
#> ℹ The deprecated feature was likely used in the srvyr package.
#>   Please report the issue at <https://github.com/gergness/srvyr/issues>.
#> # A tibble: 3 × 1
#>       x
#>   <dbl>
#> 1  424.
#> 2  626 
#> 3  848.

Created on 2023-02-20 with reprex v2.0.2

gergness commented 1 year ago

Oh, unweighted was calling summarise