dcomtois / summarytools

R Package to Quickly and Neatly Summarize Data
522 stars 78 forks source link

dfSummary fails when a whole factor column is NA #9

Closed labrax closed 6 years ago

labrax commented 6 years ago

Hi,

When I was trying to generate a dfSummary of a new dataset I could not due to an error. I could replicate the bug when running this functions on the iris dataset. This error occurs when I have a whole factor column with NAs.

This works:

data(iris)
dfSummary(iris)

Now, when I set a factor column to NA it doesn't.

iris$Species <- as.factor(rep(NA, nrow(iris)))
dfSummary(iris)

This is the error, identical to my dataset. Error in png(img_png <- tempfile(fileext = ".png"), width = 150, height = 26 : invalid 'height' argument In addition: Warning messages: 1: In max(counts) : no non-missing arguments to max; returning -Inf 2: In max(props 100) : no non-missing arguments to max; returning -Inf

Regards, Victor

dcomtois commented 6 years ago

Thanks for pointing this out, will check it out over the next few days.

dcomtois commented 6 years ago

Can you pls test again after installing dev-current?

devtools::install_github('dcomtois/summarytools', ref='dev-current')

Thanks Victor!

labrax commented 6 years ago

It is working. Thank you.

dcomtois commented 6 years ago

Fix was merged into master branch. Thanks!