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

How to calculate rowise percentages instead of the default colwise percentages. #143

Closed
mcewenkhundi opened this issue Oct 8, 2018 · 2 comments

Comments

@mcewenkhundi
Copy link

@mcewenkhundi mcewenkhundi commented Oct 8, 2018

I would like to find out how I can calculate rowise percentages. I don't seem to find an option that I can change.

Thanks

@eheinzen
Copy link
Member

@eheinzen eheinzen commented Oct 8, 2018

Consider using the option for categorical stats:

> library(arsenal)
> data(mockstudy)
> summary(tableby(sex ~ arm, data = mockstudy), text = TRUE)


|              | Male (N=916) | Female (N=583) | Total (N=1499) | p value|
|:-------------|:------------:|:--------------:|:--------------:|-------:|
|Treatment Arm |              |                |                |   0.190|
|-  A: IFL     | 277 (30.2%)  |  151 (25.9%)   |  428 (28.6%)   |        |
|-  F: FOLFOX  | 411 (44.9%)  |  280 (48.0%)   |  691 (46.1%)   |        |
|-  G: IROX    | 228 (24.9%)  |  152 (26.1%)   |  380 (25.4%)   |        |

> summary(tableby(sex ~ arm, data = mockstudy, cat.stats = "countrowpct"), text = TRUE)


|              | Male (N=916) | Female (N=583) | Total (N=1499) | p value|
|:-------------|:------------:|:--------------:|:--------------:|-------:|
|Treatment Arm |              |                |                |   0.190|
|-  A: IFL     | 277 (64.7%)  |  151 (35.3%)   |  428 (100.0%)  |        |
|-  F: FOLFOX  | 411 (59.5%)  |  280 (40.5%)   |  691 (100.0%)  |        |
|-  G: IROX    | 228 (60.0%)  |  152 (40.0%)   |  380 (100.0%)  |        |

Does that help?

@eheinzen eheinzen closed this as completed Oct 8, 2018
@mcewenkhundi
Copy link
Author

@mcewenkhundi mcewenkhundi commented Oct 9, 2018

Thanks so much, this is really helpful.

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

No branches or pull requests

2 participants