R video tutorial number 2

October 2, 2007

(This article was first published on Decision Science News » R, and kindly contributed to R-bloggers)



The Decision Science News R video tutorials continue with number 2. (If you missed that last one, you will want to watch R Video Tutorial Number 1 first.) The Goldstein pedometer dataset can be downloaded from http://www.dangoldstein.com/flash/Rtutorial2/pedometer.csv

Topics covered this week include:

  • Tricking R into starting in your working directory
  • Reading in text files
  • Accessing columns in data frames
  • Creating histograms
  • Side effects and optional parameters of function calls
  • Fitting simple linear models
  • Adding least-squares and loess lines to plots

The commands in the tutorial are:

myData=read.table("pedometer.csv", header=TRUE, sep=",")
plot(myData$Steps ~ myData$Observation,col="blue")
myModel=lm(myData$Steps ~ myData$Observation)

Can’t view flash? Download movie If you see no image under Windows, download the TSSC Codec.

To leave a comment for the author, please follow the link and comment on their blog: Decision Science News » R.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Tags: , ,

Comments are closed.

Search R-bloggers


Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)