Reputation: 1
I'm new beginner to R, trying to cross-tabulate the variables, use the ctable()
function from package "summarytools".
But I'm encountering some errors that look like the following.
I'm learning to use R by following the worksheet for categorical data analysis of R. The result should look like this.
I will be grateful if you can help me to figure out what's going wrong.
Upvotes: 0
Views: 1034
Reputation: 21
Per others, yes include data and code so the error is reproducible.
I just had this issue when I updated R and packages - not sure if it was a new version of summarytools or something else. Make sure the columns you will use in ctable are factor. Not sure if yours are character. I was having this problem because my columns were numeric.
Something like (using dplyr):
elsa <- elsa %>%
mutate(
sex = factor(sex),
heart_attack = factor(heart_attack)
)
ctable(elsa$sex,elsa$heart_attack)
Good luck!
Upvotes: 2