dcomtois / summarytools

R Package to Quickly and Neatly Summarize Data
502 stars 77 forks source link

ctable error: attempt to set 'rownames' on an object with no dimensions #145

Closed chris-dworschak closed 3 years ago

chris-dworschak commented 3 years ago

Awesome package, thank you!

I hope I'm not overlooking anything obvious here, but whenever I include the prop = "n" argument in ctable(), I'm encountering the error

Error in `rownames<-`(x, value) : 
  attempt to set 'rownames' on an object with no dimensions

and sometimes the same for "colnames". Below a MWE to reproduce the rownames error:

set.seed(121)
ctable(rpois(100,2), rpois(100,2))
ctable(rpois(100,2), rpois(100,2), prop = "n")

Cheers!

dcomtois commented 3 years ago

Hi, I confirm... will issue a fix as soon as possible. Thanks for reporting this.

dcomtois commented 3 years ago

Note that in the meantime, you can do something like this:

a <- as.factor(rpois(100,2))
b <- as.factor(rpois(100,2))
ctable(a,b,prop="n")
dcomtois commented 3 years ago

Fixed in v1.0.0