Session Ready
Exercise

Ranks

You can create a data frame using the data.frame function. Here is a quick example:

temp <- c(35, 88, 42, 84, 81, 30)
city <- c("Beijing", "Lagos", "Paris", "Rio de Janeiro", "San Juan", "Toronto")
city_temps <- data.frame(name = city, temperature = temp)
Instructions
100 XP
  • Define a variable states to be the state names from murders
  • Use rank(murders$population) to determine the population size rank (from smallest to biggest) of each state.
  • Save these ranks in an object called ranks.
  • Create a data frame with state names and their respective ranks. Call the data frame my_df.