亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

錯誤:代碼中意外的符號/輸入/字符串常量/數值常數/特殊

錯誤:代碼中意外的符號/輸入/字符串常量/數值常數/特殊

智慧大石 2019-07-06 17:53:19
錯誤:代碼中意外的符號/輸入/字符串常量/數值常數/特殊我收到了其中一個錯誤。Error: unexpected symbol in "<my code>"    Error: unexpected input in "<my code>"Error: unexpected string constant in "<my code>"  Error: unexpected numeric constant in "<my code>"   Error: unexpected SPECIAL in "<my code>"         Error: unexpected '<some punctuation>' in "<my code>" Error: unexpected '<reserved word>' in "<my code>"        這個錯誤意味著什么,我如何修正它?一些重現錯誤的簡單示例和常見的變體:a a## Error: unexpected symbol in "a a"a\## Error: unexpected input in "a\"a""## Error: unexpected string constant in "a"""""1## Error: unexpected numeric constant in """1"%%## Error: unexpected SPECIAL in "%%",## Error: unexpected ',' in ","=## Error: unexpected '=' in "=")## Error: unexpected ')' in ")"else## Error: unexpected 'else' in "else"
查看完整描述

2 回答

?
慕尼黑5688855

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


查看完整回答
反對 回復 2019-07-06
  • 2 回答
  • 0 關注
  • 8812 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號