The table() function is intended for use during the Data Exploration phase of Data Analysis. The table() function performs categorical tabulation of data. In the R programming language, “categorical” variables are also called “factor” variables. The tabulation of data categories allows for Cross-Validation of data. Thereby, finding possible flaws within a dataset, or possible flaws […]

## Data Exploration with Tables – Solutions

Below are the solutions to these exercises on Data Exploration with Tables. #################### # # # Exercise 1 # # # #################### table(DiningSurvey$Gender) ## ## Female Male ## 2 2 #################### # # # Exercise 2 # # # #################### table(DiningSurvey$Count > 650) ## ## FALSE TRUE ## 3 1 #################### # # # Exercise […]

## Merging Dataframes Exercises

When combining separate dataframes, (in the R programming language), into a single dataframe, using the cbind() function usually requires use of the “Match()” function. To simulate the database joining functionality in SQL, the “Merge()” function in R accomplishes dataframe merging with the following protocols; “Inner Join” where the left table has matching rows from one, […]

## Merging Dataframes – Solutions

[emaillocker]Below are the solutions to these exercises on Merging Dataframes. #################### # # # Exercise 1 # # # #################### # Create the dataframes to merge: buildings <- data.frame(location=c(1, 2, 3), name=c("building1", "building2", "building3")) data <- data.frame(survey=c(1,1,1,2,2,2), location=c(1,2,3,2,3,1), efficiency=c(51,64,70,71,80,58)) # Solution buildingStats <- merge(buildings, data, by="location") #################### # # # Exercise 2 # # # […]