We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hello,
I am trying to use fct_infreq with strata for tableby and the output is not correct.
fct_infreq
tableby
Example with mtcars:
mtcars
library(arsenal) Table <- tableby( ~ fct_infreq(as.factor(gear)), strata = as.factor(cyl), data = mtcars) summary(Table)
And the output is:
|as.factor(cyl) | | Overall (N=32) | |:--------------|:-------------------------------|:--------------:| |4 |**fct_infreq(as.factor(gear))** | | | | 3 | 1 (9.1%) | | | 4 | 8 (72.7%) | | | 5 | 2 (18.2%) | |6 |**fct_infreq(as.factor(gear))** | | | | 3 | 2 (28.6%) | | | 4 | 4 (57.1%) | | | 5 | 1 (14.3%) | |8 |**fct_infreq(as.factor(gear))** | | | | 3 | 12 (85.7%) | | | 4 | 0 (0.0%) | | | 5 | 2 (14.3%) |
I would have guessed that the factors would be sorted by frequency within each stratum, so that the final output would have been something like:
stratum 4: 4, 5, 3 stratum 6: 4, 3, 5 stratum 8: 3, 5, 4
Is there something different that needs to be done so that factor levels are sorted within each stratum?
Thank you, Alex
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hello,
I am trying to use
fct_infreq
with strata fortableby
and the output is not correct.Example with
mtcars
:And the output is:
I would have guessed that the factors would be sorted by frequency within each stratum, so that the final output would have been something like:
stratum 4: 4, 5, 3
stratum 6: 4, 3, 5
stratum 8: 3, 5, 4
Is there something different that needs to be done so that factor levels are sorted within each stratum?
Thank you,
Alex
The text was updated successfully, but these errors were encountered: