简体   繁体   English

R 中的代码块给出“意外符号”错误

[英]Code chunks in R give “unexpected symbol” error

For some reason, R markdown literally won't do anything without some vague error.出于某种原因,如果没有一些模糊的错误,R markdown 实际上不会做任何事情。 I'm trying to run the simplest code chunk, but I get an error.我正在尝试运行最简单的代码块,但出现错误。 I've tried both manually typing the chunk, and inserting it from R's selection我试过手动输入块,并从 R 的选择中插入它

在此处输入图像描述

1.s is not a valid symbol in R , 1.s不是R中的有效符号,

(1) if you are trying to name a variable, it cannot start with a number (1) 如果你试图命名一个变量,它不能以数字开头

(2) name like s.1 is valid, but you have to make it an object, ie either assign a value or a function etc. s.1=1 will work in the Rmarkdown (2) s.1之类的名称有效,但您必须将其设为 object,即分配一个值或 function 等。s.1 s.1=1将在 Rmarkdown 中工作

(3) if you just want to put some text here, you need to comment them by putting # before it, ie #1.s (3) 如果你只是想在这里放一些文字,你需要在它前面加上#来注释它们,即#1.s

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM