R 使用elseif从函数生成向量
我想使用一个向量R 使用elseif从函数生成向量,r,if-statement,R,If Statement,我想使用一个向量(tempay addR标记?这是什么语言?谢谢,我是新手。我现在已经添加了标记R,尝试编辑标题,但没有成功:(查看函数ifelse()。它的目的是获取向量而不是单个值。ifelse(Temp "In if (Temp <= -5) { : the condition has length > 1 and only the first element will be used" my_funct <- function(Temp){ if(Temp&l
(tempay addR
标记?这是什么语言?谢谢,我是新手。我现在已经添加了标记R,尝试编辑标题,但没有成功:(查看函数ifelse()
。它的目的是获取向量而不是单个值。ifelse(Temp
"In if (Temp <= -5) { :
the condition has length > 1 and only the first element will be used"
my_funct <- function(Temp){
if(Temp<= -5){y<- 100} else if(Temp<=5){y<-Temp^2} else {y<-Temp}
y
}