其他分享
首页 > 其他分享> > R语言|ifelse的用法

R语言|ifelse的用法

作者:互联网

ifelse returns a value with the same shape as test which is filled with elements selected from either yes or no depending on whether the element of test is TRUE or FALSE. 

Usage:
ifelse(test, yes, no)

示例:
base_data$sbp<-ifelse(is.na(base_data$sbp_a1),base_data$sbp_m1,base_data$sbp_a1)

 

标签:语言,no,示例,用法,shape,ifelse,test,yes
来源: https://www.cnblogs.com/violablog/p/15726144.html