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 sfirke
It might be from the rlang package? I'm not really sure how to help further since it's not a janitor-related issue, sorry.
You might try posting a question on StackOverflow for help.
On Thu, Jun 24, 2021, 7:19 PM RachelK1994 ***@***.***> wrote:
Thank you very much for getting back to me @sfirke https://github.com/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
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sfirke/janitor/issues/317#issuecomment-868022178, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABZYDEBVJD52PSEQUJTDOHTTUO4PFANCNFSM4JRMHA3Q .
Related questionsNo questions were found.