R语言 if else 语句

R语言中if else语句的编写格式

因为R是解释语言,如果else单独起一行,无法解释执行。

所以else不能单独一行,最好这样写:

if(a) {
    print("hello")} else {
    print("Hi")}

posted @ 2012-12-14 11:44  bore3601  阅读(12866)  评论(0编辑  收藏  举报