Skip to Content
R Programming Fundamentals
book

R Programming Fundamentals

by Kaelen Medeiros
September 2018
Beginner
206 pages
4h 27m
English
Packt Publishing
Content preview from R Programming Fundamentals

Tables in R

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 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

R Programming Fundamentals

R Programming Fundamentals

Samik Sen, Marcin Dubel
Python for Programmers

Python for Programmers

Paul Deitel, Harvey Deitel

Publisher Resources

ISBN: 9781789612998Supplemental Content