This is the fifth in a series of lectures on R.
10 minutes is a shockingly short period of time!
Today, we read in some datasets that come with R. To list, use the data() command, find what you want, then use the name of the dataset in the data() function. Like data(ToothGrowth).
The question mark ? may be used to ask for help for datasets.
Always try summary() for everything. It will almost always give you what you expect.
Also try plot().
Open the myRcode.R file we saved in our myR folder. Windows users have it in their “C” drive. Mac users have it on their Desktop.Linux users have it in their home path.
Reminder: DO NOT USE MICROSOFT WORD.
Cut and paste or type the following NEW block of text into your myRcode.R file and SAVE it.
# Built-in datasets
data()
data(ToothGrowth)
?ToothGrowth
ToothGrowth
summary(ToothGrowth)
plot(ToothGrowth)
We will cut & paste this code from the file myRcode.R into the R command window. EACH TIME REMEMBERING TO HIT THE ENTER KEY (inside R).
R can be downloaded here: R-project.org. A direct link to the CRAN package archive is here.
Next time: finding commands and plotting! The next lesson will appear on the weekend.
All videos are on YouTube under the username “mattstat” (wmbriggs was taken). That service imposes a ten-minute limit of videos. Accordingly, lectures are short.
All questions to matt@wmbriggs.com.
Last line of pre-typed code: ‘ploot(ToothGrowth)’
I thought this must be some fancy variation on ‘plot’, but it appears to be a typo.
PLOOT ?
Maybe you mean PLOT.
Stephen, B. Humphreys,
Oops. Yes, it’s “plot” and not “ploot”. Thanks.