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.
I can't say for sure but it looks like
:= is used in the
data.table package, and since you load that package after the tidyverse packages, it's calling the
data.table version of that operator. Try not loading
data.table and seeing if that fixes your problem.