Aggregating Data in Big Data Frame Using R

I’m training to use R to work with real-life data, not just in the simplified learning context. And I publish notes about it with pieces of code that I hope to use again. See below the sample of aggregating the data using aggregate commands. Also, I show how to combine the data from several sources into one data frame using the cbind command. After I have created the resulting data frame, I sorted it using the order command. And I drew a visually appealing table based on that data frame using a grid library.  I hope some of my R code chunks will also be useful to you.
Yesterday I have found a large and interesting data set at https://catalog.data.gov/dataset/nutrition-physical-activity-and-obesity-behavioral-risk-factor-surveillance-system-f645f. It provides aggregated data on obesity, nutrition and physical activity of American citizens.
You may want to reproduce my actions in R. To do this, you can download the data set here if it suddenly becomes unavailable by the original link. As far as I understand, this dataset can be freely distributed.

Continue reading “Aggregating Data in Big Data Frame Using R”