change<-function(){
play <- scan(what="character")
numbers<-c("1","3","4","9","10")
while(! all(is.element(play,numbers))){
data.entry(play)
}}
change()
当我输入3 4 100扫描,并在data.entry中更改它,但更改后的数据不会被分配到播放中,为什么?
正如@ r2evans所说,我将我的代码修复为以下内容,问题解决了。
change<-function(){
play <- scan(what="character")
numbers<-c("1","3","4","9","10")
while(! all(is.element(play,numbers))){
data.entry(play)
return(play)
}}
change()
这仍然不是一个好技术,当我把代码放在程序中时,返回(播放)后的代码永远不会被执行。
我将其修复为:
change<-function(){
play <- scan(what="character")
numbers<-c("1","3","4","9","10")
while(! all(is.element(play,numbers))){
play <- fix(play)
}}
change()