R CMD BATCH问题:意外的输入错误

时间:2012-07-24 20:54:27

标签: r

我正在尝试使用以下内容运行R脚本,

c:\Progra~1\R\R-2.13.1\bin\R CMD BATCH "test.R"

文件test.R包含

print ("Hello World")

但是,我一直收到以下错误。上面的例子只用一行就很简单,使调试更容易。

R version 2.13.1 (2011-07-08)
Copyright (C) 2011 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i386-pc-mingw32/i386 (32-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> pError: unexpected input in "print ("Hello World")
"
Execution halted

如果我添加一个;打印后签名(“Hello World”),但如果test.R中有其他行则永远不会被执行。

你能告诉我吗。

1 个答案:

答案 0 :(得分:0)

我使用Textpad编辑test.R.但出于某种原因,我认为它引入了一些不可打印的字符。

一旦我在Unix中创建了test.R并复制到Windows,它就没有任何错误。