Statistics

R Lecture 4: Help & Plotting

This is the fourth in a series of lectures on R.

10 minutes is a shockingly short period of time!

Today, we learn the R way to create comments: start lines with “#”.

We also learn how to find functions if we don’t already know them, but we think we might know their name. This is through the apropos() function.

This leads us to plot(). One way to ask for help in R is to prepend a question mark “?” to the function name. Thus, “?plot”. This always gives a function description, how to call that function, the arguments and what they mean, details, and a cut-and-pastable example.

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.


# help plot
x = 7
y = 8
apropos('plot')
plot(x,y)

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.

Categories: Statistics

2 replies »

  1. Needs to be tagged under Podcast along with the rest of the R lectures (just to make it easy for dolts like me to find the next time I need to)

    Ron

    (PS: Thanks for taking time to do this –Ron)

  2. Ron,

    Thanks for the reminder. You can also look under the Statistics category in the left column. Under “R Lectures.”

Leave a Reply

Your email address will not be published. Required fields are marked *