Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

survey_count() fails with numeric columns #74

Closed
tzoltak opened this issue Apr 9, 2020 · 1 comment
Closed

survey_count() fails with numeric columns #74

tzoltak opened this issue Apr 9, 2020 · 1 comment

Comments

@tzoltak
Copy link
Contributor

tzoltak commented Apr 9, 2020

Reprex:

library(survey)
#> Ładowanie wymaganego pakietu: grid
#> Ładowanie wymaganego pakietu: Matrix
#> Ładowanie wymaganego pakietu: survival
#> 
#> Dołączanie pakietu: 'survey'
#> Następujący obiekt został zakryty z 'package:graphics':
#> 
#>     dotchart
library(srvyr)
#> 
#> Dołączanie pakietu: 'srvyr'
#> Następujący obiekt został zakryty z 'package:stats':
#> 
#>     filter
data(api)

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

survey_count(dstrata, api00)
#> Warning: Coercing api00 to character.
#> Error: Can't join on 'api00' x 'api00' because of incompatible types (character / integer)

Created on 2020-04-09 by the reprex package (v0.3.0)

@gergness
Copy link
Owner

Fixed via #88

library(survey)
#> Loading required package: grid
#> Loading required package: Matrix
#> Loading required package: survival
#> 
#> Attaching package: 'survey'
#> The following object is masked from 'package:graphics':
#> 
#>     dotchart

library(srvyr)
#> 
#> Attaching package: 'srvyr'
#> The following object is masked from 'package:stats':
#> 
#>     filter

data(api)

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

survey_count(dstrata, api00)
#> Warning: Coercing api00 to character.
#> # A tibble: 156 x 3
#>    api00     n  n_se
#>    <int> <dbl> <dbl>
#>  1   398  44.2  44.2
#>  2   403  20.4  20.4
#>  3   409  35.5  25.3
#>  4   418  15.1  15.1
#>  5   421  44.2  44.2
#>  6   423  44.2  44.2
#>  7   443  20.4  20.4
#>  8   453  15.1  15.1
#>  9   455  15.1  15.1
#> 10   467  35.5  25.3
#> # … with 146 more rows

Created on 2020-07-25 by the reprex package (v0.3.0)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants