Skip to content
Prev 305859 / 398502 Next

drop zero slots from table?

Function
--8<---------------cut here---------------start------------->8---
sorted.table <- function (vec) {
  tab <- table(vec)
  tab <- tab[tab > 0]
  sort(tab, decreasing=TRUE)
}
--8<---------------cut here---------------end--------------->8---
does what I want but it prints "vec" instead of the name of its
argument:
--8<---------------cut here---------------start------------->8---
vec
  A  B
  10 3
--8<---------------cut here---------------end--------------->8---
how do I pass all arguments of sorted.table() on to table() as is?
thanks!