在R中创建向量有哪些限制?
在R中创建向量有四个主要限制。在创建任何类型的向量时,我们必须记住这些限制-
向量名称不能带有%符号。
向量名称不能以数字开头。
向量可以以点开头,但后面不能有数字。
向量不能以下划线开头。
例子
带%符号的向量-
x1%<-1:20 Error: unexpected input in "x1%<-1:20" x1%first<-1:20 Error: unexpected input in "x1%first<-1:20" %x1<-1:20 Error: unexpected input in "%x1<-1:20" x1_%_first<-1:20 Error: unexpected input in "x1_%_first<-1:20" x1first_1_%<-1:20 Error: unexpected input in "x1first_1_%<-1:20" x1first__%<-1:20 Error: unexpected input in "x1first__%<-1:20"
以数字开头的向量-
1x<-1:20 Error: unexpected symbol in "1x" 1_x<-1:20 Error: unexpected input in "1_" 101_x<-1:20 Error: unexpected input in "101_" 123_x<-1:20 Error: unexpected input in "123_" 1number_x<-1:20 Error: unexpected symbol in "1number_x" 1number<-1:20 Error: unexpected symbol in "1number"
以点开头的向量-
.x1<-1:10 .x1 [1] 1 2 3 4 5 6 7 8 9 10 .1x<-1:10 Error: unexpected symbol in ".1x" .1_x<-1:10 Error: unexpected input in ".1_" .100_x<-1:10 Error: unexpected input in ".100_" .1of_x<-1:10 Error: unexpected symbol in ".1of_x" .2of_x<-1:10 Error: unexpected symbol in ".2of_x" .1ofx<-1:10 Error: unexpected symbol in ".1ofx"
以下划线开头的向量-
_x1<-1:10 Error: unexpected input in "_" _first<-1:10 Error: unexpected input in "_" _first_variable<-1:10 Error: unexpected input in "_" _variable1<-1:10 Error: unexpected input in "_" _firstvariable<-1:10 Error: unexpected input in "_" _V1<-1:10 Error: unexpected input in "_" _1_var <-1:10 Error: unexpected input in "_"
热门推荐
1 带狗狗训练
4 听力训练狗狗
6 怎训练狗狗
7 腹肌训练狗狗
8 网球训练狗狗
9 记叙文训练狗狗
10 狗狗太凶怎么训练
11 核心力量训练狗狗
12 狗狗乱叫怎么训练
13 发音训练狗狗
14 怎么训练狗狗叼东西给主人
15 荆州训练狗狗
16 篮球训练狗狗
17 做训练狗狗
18 训练狗狗坐姿