Monthly Archives: March 2011

Exporting Data

Exporting data from R to some other format is just as simple as getting the data in.  I like working with comma-separated value files (.csv) but sometimes I want to export directly into Stata or SPSS.  Let’s create a (correlated) … Continue reading

Posted in Uncategorized | Leave a comment

Installing Packages

Packages contain collections of functions.  The R community has generated over 1,000 different packages.  R come with a base set of packages including the ‘stats’ package.  You will probably at some point want to install additional packages that can handle … Continue reading

Posted in Uncategorized | Leave a comment

More on Introductory Functions

Here are a bunch of introductory functions that I use all the time. If I haven’t said it before, I’ll say it now, the ‘#’ symbol is the start of my comments.  Anything to the right of the ‘#’ symbol … Continue reading

Posted in Uncategorized | Leave a comment

Quick Numerical and Graphical Summaries of Data

Let’s generate a small dataset to work with x<-rnorm(100) y<-rnorm(100)+10 #The mean of y will be 10 units higher than x #Let’s correlate these data using a Pearson correlation of .4 r<-.4 y<-x*r+y*sqrt(1-r^2) g<-c(rep(“m”,50),rep(“f”,50)) We can put each of these … Continue reading

Posted in Uncategorized | Leave a comment