从R文件导入内容

luc*_*asn 7 r

我正在研究R,我被要求使用在SimpleR库中提供的pi2000数据集(http://www.math.csi.cuny.edu/Statistics/R/simpleR/index.html/simpleR.R).然后我下载了这个文件.如何将其导入命令行?

Ale*_*own 17

使用source功能:

> source("http://www.math.csi.cuny.edu/Statistics/R/simpleR/index.html/simpleR.R")
Run Code Online (Sandbox Code Playgroud)

然后,您可以访问那里定义的变量:

> 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
Run Code Online (Sandbox Code Playgroud)

有关更多信息,请键入?sourceR终端.


Ale*_*lds 5

你的意思是将功能加载到R?如果是这样,请使用source():

source("http://www.math.csi.cuny.edu/Statistics/R/simpleR/index.html/simpleR.R")
Run Code Online (Sandbox Code Playgroud)