Zhang Linruo
Zhang Linruo

Reputation: 1

Error in prettyNum(.Internal(format(x, trim, digits, nsmall, width, 3L, : invalid value 0 for 'digits' argument

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. enter image description here

I'm learning to use R by following the worksheet for categorical data analysis of R. The result should look like this. enter image description here

I will be grateful if you can help me to figure out what's going wrong.

Upvotes: 0

Views: 1034

Answers (1)

bstRack
bstRack

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

Related Questions