You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm used to doing statar::tab(myvector) to tabulate vectors (same for sum_up). It seems that in the latest version of statar that tab only works on data.frames now.
I'm sure there are reasons for this choice, but is there any chance we could have statar::tab branch for vectors? Right now I'm masking tab with some code (below), but an official implementation would be better.
# wrapper for statar::tab, to handle vector input
tab <- function(x, ...) {
xname_enquo <- enquo(x)
xname <- deparse(substitute(x))
if(is.vector(x)) {
x <- data.frame(x)
names(x) <- xname
statar::tab(x,!!xname_enquo,...)
} else if(is.data.frame(x)) {
statar::tab(x,...)
}
}
myvect <- c(1,2,3,3,3)
myvect %>% tab # works like it did in older version
tab(myvect) # same
tab(data.frame(x=c(1,2,3)),x) # still works
myvect %>% statar::tab(.) # throws error
Thanks!
The text was updated successfully, but these errors were encountered:
Hi,
I'm used to doing
statar::tab(myvector)
to tabulate vectors (same forsum_up
). It seems that in the latest version of statar that tab only works ondata.frame
s now.I'm sure there are reasons for this choice, but is there any chance we could have
statar::tab
branch for vectors? Right now I'm masking tab with some code (below), but an official implementation would be better.Thanks!
The text was updated successfully, but these errors were encountered: