2 回答

TA貢獻1848條經驗 獲得超2個贊
對我來說,錯誤是:
Error: unexpected input in "?"
修補程序是在十六進制編輯器中打開腳本,并從文件中刪除前3個字符。該文件是從一個UTF-8 BOM開始的,而且Rscript似乎無法讀取它。
編輯:OP請求一個示例。開始吧。
? ~ cat a.R
cat('hello world\n')
? ~ xxd a.R
00000000: efbb bf63 6174 2827 6865 6c6c 6f20 776f ...cat('hello wo
00000010: 726c 645c 6e27 290a rld\n').
? ~ R -f a.R
R version 3.4.4 (2018-03-15) -- "Someone to Lean On"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-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.
> cat('hello world\n')
Error: unexpected input in "?"
Execution halted
- 2 回答
- 0 關注
- 8812 瀏覽
添加回答
舉報