sample函数获得的数据框为何下面是“+”号?而且eyecolor变量不能看?

来源:3-2 .while()和repeat()-新版

慕设计226598

2019-04-08 20:32

> sample(eye.color,100,rep=T)

  [1] "bb" "aa" "cc" "dd" "cc" "cc" "bb" "dd" "cc" "cc" "dd" "bb" "cc" "dd" "cc"

 [16] "aa" "cc" "aa" "aa" "bb" "aa" "cc" "aa" "bb" "bb" "dd" "cc" "bb" "dd" "dd"

 [31] "dd" "dd" "cc" "cc" "dd" "aa" "dd" "aa" "cc" "aa" "cc" "aa" "dd" "dd" "cc"

 [46] "aa" "bb" "dd" "cc" "bb" "bb" "dd" "cc" "bb" "bb" "aa" "bb" "aa" "dd" "dd"

 [61] "aa" "aa" "aa" "cc" "bb" "aa" "cc" "bb" "bb" "bb" "aa" "bb" "dd" "aa" "aa"

 [76] "aa" "aa" "aa" "cc" "dd" "aa" "bb" "cc" "dd" "dd" "bb" "bb" "dd" "aa" "bb"

 [91] "bb" "aa" "dd" "cc" "cc" "bb" "bb" "dd" "dd" "bb"

> eyecolor<-data.frame(id=1:100,color=sample(eye.color,100,rep=T)   #sample函数获得的数据框为何下面是“+”号?


> eyecolor

Error: object 'eyecolor' not found


写回答 关注

1回答

  • 慕仙1167953
    2019-04-13 10:25:01
    已采纳

    +说明你的语句没有写完整啊。。  

    你自己看下,data.frame后面的括号,在语句最后并没有完整封闭。。就是语句最后面漏了个括号

R语言入门与进阶

这门课将会带领您领略R语言的精髓,打开R语言的大门。

20104 学习 · 19 问题

查看课程

相似问题