There are a couple of sample dataframes in R. For this exercise, we will work with some of them. We will also train your “help yourself” instincts. There is ample help on the web. Platforms like stackoverflow provide great answers to most of your R-related questions.
Let’s give it a try.
Example 1)
# Load the data set on USA Arrest rates. data ( "USArrests" )
Answer the following questions (with the help of online resources).
- Sort the data by the Murder rate. Which state has the highest murder rate?
- What is the average murder rate across all states?
- What is the correlation between urban population and murder rates?
Example 2)
# Let's look at some data on judges. data ( "USJudgeRatings" )
- What judge has the highest overall rating?
- Which category is the highest rated overall?
Example 3)
# Finally, let's take a look at Canada and the Canadian lynx dataset. data ( "lynx" )
- Plot the number of lynx hunted every year.
- Try different plot types. Which visualization is most appropriate?
access_time Last update May 8, 2020.