September 2018
Beginner
206 pages
4h 27m
English
Tables in R are very helpful when you want to create a grid of counts of one or two categorical variables. They can be saved as an object for export or in combination with other summary tables.
We've used the iris dataset numerous times by now, and have observed that there are 50 of each species of flower in the data. To create a table to verify it, use the table() function. If you input a variable of interest to table(), R will return a table of the values of the input variable with a count of how many observations have that particular value.
You can also create two-way tables, though we'll need to use a different dataset, as there's only one categorical variable in iris. To create a two-way variable, input two different variables ...