sample函數(shù)獲得的數(shù)據(jù)框?yàn)楹蜗旅媸?ldquo;+”號(hào)?而且eyecolor變量不能看?
> 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函數(shù)獲得的數(shù)據(jù)框?yàn)楹蜗旅媸恰?”號(hào)?
+?
+?
+?
+?
+?
+?
> eyecolor
Error: object 'eyecolor' not found
2019-04-13
+說(shuō)明你的語(yǔ)句沒(méi)有寫(xiě)完整啊。。??
你自己看下,data.frame后面的括號(hào),在語(yǔ)句最后并沒(méi)有完整封閉。。就是語(yǔ)句最后面漏了個(gè)括號(hào)