Open stephpenn1 opened 5 years ago
which.max(mtcars$drat)
which.max(mtcars$drat) print(which.max(mtcars$drat))
Nice all! 👏 Clearly that was too easy.
subset()
function (in particular, look at the examples on its help page). Understand it. mtcars
to just the 4-cylinder engines, and then plot mpg vs. hp as above, but with a panel (see ggplot's facet_wrap()
) for each value of carb
.Very nice people! 👏 Closing this, unless you're really dying for more data manipulation exercises. @stephpenn1 and I will work on agenda/syllabus for next week.
In addition to
cars
, R has a built-in dataset calledmtcars
.summary
; get the number of rows and columns.drat
column frommtcars
and prints its summary. Which row of the dataset has the maximumdrat
value? Write code to find this.plot(mtcars)
. Whoah! What’s going on here? What hasplot
done?qplot
function, miles per gallon versus horsepower. Color the points by one of the other columns.ggsave()
commandTips:
?qplot
to get helpggplot2
package firstFeel free to slack/email/find us if you need any help!