Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Import stuff from a R file

Tags:

r

I'm studying R, and I was asked to use the pi2000 data set, available at the simpleR library (http://www.math.csi.cuny.edu/Statistics/R/simpleR/index.html/simpleR.R). Then I downloaded this file. How do I import it to the command line?

like image 879
lucasn Avatar asked Jan 03 '12 05:01

lucasn


1 Answers

Use the source function:

> source("http://www.math.csi.cuny.edu/Statistics/R/simpleR/index.html/simpleR.R")

You can then access the variables defined there:

> vacation
 [1] 23 12 10 34 25 16 27 18 28 13 14 20  8 21 23 33 30 13 16 14 38 19  6 11 15 21 10
[28] 39 42 25 12 17 19 26 20

for more information, type ?source into an R terminal.

like image 156
Alex Brown Avatar answered Sep 25 '22 21:09

Alex Brown