Member-only story

Label Your Table — How to Put Margins On Tables or Arrays in R Programming

Contingency tables audit the data you have. You have a lot of table options in R. Here is an overview to raise your data analysis game.

Pierre DeBois
8 min readOct 31, 2023

When data is analyzed, it is not unusual to put the data into a table. After all, most people are used to a spreadsheet in business. But what if your table is in a program and you need to add some information alongside the table? There are several options within R programming to label your table.

table()

A table in R programming is a contingency table that displays the number of items within your object. They are designed to present counts or percentages of one or more variables, so they are helpful in matrices and data frame objects.

The table function was mentioned in the post about using cut2 to bin data into categories between numeric ranges. You can set up a table with to display each group range for the object bins. Bins is a dataset object containing the gtcars dataset grouped into 3 bins via the cut2() function (This is the same example from that cut2 post).

--

--

Pierre DeBois
Pierre DeBois

Written by Pierre DeBois

#analytics |#datascience |#JS |#rstats |#marketing services for #smallbiz | #retail | #nonprofits Contrib @CMSWire @smallbiztrends #blackbusiness #BLM

No responses yet