R projects

There are some (rare) cases where a single R script contains the totality of your research/analyses. This may happen if you are doing simulation studies, for example. For most cases, an analysis will consist of a script (or scripts) and at least one data set. I refer to any R analysis that uses at least two files as an R project.

In R projects, special attention must be paid to how the files are stored relative to each other. For example, if we stored the file SAT_Scores_NYC_2010.csv on our desktop, the data import line would have read:

read.csv("/Users/bensisko/Desktop/SAT_Scores_NYC_2010.csv")

If you want to send this analysis to a contributor to be replicated, we would send them the script and the data file. Even if we instructed them ...

Get R: Data Analysis and Visualization now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.