It should be simple enough, but I'm just not finding what I need in the documentation. I'm sure I just don't know what to look for.
它应该很简单,但我只是在文档中找不到我需要的东西。我确定我只是不知道该找什么。
I'm new to R and have started writing a script that will generate a sequence from 3 user input variables.
我是R的新手并且已经开始编写一个脚本,它将从3个用户输入变量生成一个序列。
basically, I want this
基本上,我想要这个
sequence<-seq(1,10,by=2)
to be done with
完成
seqStart<-readline(prompt="Sequence Start")
seqStop<-readline(prompt="Sequence Stop")
seqInt<-readline(prompt="Interval")
sequence<-seq(seqStart, seqStop, by=seqInt)
1 个解决方案
#1
1
You need to convert the result of readline to numeric:
您需要将readline的结果转换为数字:
seqStart <- as.numeric(readline(prompt="Sequence Start"))
seqStop <- as.numeric(readline(prompt="Sequence Stop"))
seqInt <- as.numeric(readline(prompt="Interval"))
mySequence <- seq(seqStart, seqStop, by=seqInt)
#1
1
You need to convert the result of readline to numeric:
您需要将readline的结果转换为数字:
seqStart <- as.numeric(readline(prompt="Sequence Start"))
seqStop <- as.numeric(readline(prompt="Sequence Stop"))
seqInt <- as.numeric(readline(prompt="Interval"))
mySequence <- seq(seqStart, seqStop, by=seqInt)