Ask questionsUsing tabyl with index-numbers
I would like to use tabyl for recurring procedures with a map()-function, looping over several variables in a data frame without naming them, but rather just have the loop access the next variable in line. It is possible with table(), but I don't like table()'s properties and rather do it with tabyl().
Here is an example with table():
map(mtcars[1:6], function(x) table(x,mtcars$gear))
With tabyl I would have to specify each tabulation, correct?
tabyl(mtcars, mpg, gear) tabyl(mtcars, cyl, gear) # etc. tabyl(mtcars, wt, gear)
That seems tedious to me and I would prefer a looping-solution.
Answer questions RachelK1994
Thank you very much for getting back to me @sfirke! I've tried this but unfortunately I then get the message, " Error in
:=(!!varname, value) : could not find function ":="" - is it just the "dplyr" package I need to read in or is there perhaps another package I'm missing (or perhaps I've loaded another redundant package that is causing the issue)? Best,Rachel
Related questionsNo questions were found.