This lesson is called Crosstabs, part of the Fundamentals of R (v1) course. This lesson is called Crosstabs, part of the Fundamentals of R (v1) course.
Complete the crosstabs sections of the data-wrangling-and-analysis-exercises.Rmd file. Make sure that you have the janitor package installed (if not, use the install.packages function) and loaded (use the library function).
Learn More
The janitor package has a great vignette with information about the tabyl and adorn_ functions.
Have any questions? Put them below and we will help you out!
You need to be signed-in to comment on this post. Login.
I noticed that the rendered table you get when knitting after adding a third variable is not the same you get when doing only two (it is only text, not the nice table format). Is there a way to get the same type of table rendered?
For the last coding solution - what do the $ indicate next to the age_decade? Will this show up in the table in the final report (once we convert to word or other)? Is there a way to remove that and just show the actual age_decade labels?
Is there a way to show both column & row percentages using tabyl? Or is there another crosstab function that could do this? (I'm thinking similar to a proc freq in SAS, which has frequency, percent, column percent and row percent for each cell)
You need to be signed-in to comment on this post. Login.
Daniel Sossa
March 14, 2021
I noticed that the rendered table you get when knitting after adding a third variable is not the same you get when doing only two (it is only text, not the nice table format). Is there a way to get the same type of table rendered?
David Keyes Founder
March 16, 2021
Alright, so this is not my strongest area, but I tried to explain this a bit in this video. Hope it helps!
Jyoni Shuler
March 26, 2021
To solve the error message and remove the N/As, would we use the 'drop_na' function then?
Tatiana Bustos
July 28, 2022
For the last coding solution - what do the $ indicate next to the age_decade? Will this show up in the table in the final report (once we convert to word or other)? Is there a way to remove that and just show the actual age_decade labels?
Emma S
October 6, 2022
Is there a way to show both column & row percentages using tabyl? Or is there another crosstab function that could do this? (I'm thinking similar to a proc freq in SAS, which has frequency, percent, column percent and row percent for each cell)