x <- seq(-2,2,by = 0.1)
if(x <= 0){
y <- -x^3
}else if(x <= 1){
y <- x^2
}else{
y <- sqrt(x)
}
show(y)
出现问题
Warning message:
In if (x <= 0) { :
the condition has length > 1 and only the first element will be used
应该怎么改?
急急急!!!
|
楼主: LRB182
|
1033
2
[问答] 编写函数用if-else出现问题 |
|
高中生 22%
-
|
| ||
|
|
| ||||||||
加好友,备注cda京ICP备16021002号-2 京B2-20170662号
京公网安备 11010802022788号
论坛法律顾问:王进律师
知识产权保护声明
免责及隐私声明


