Displaying 1 result from an estimated 1 matches for "sd_and_data1".
2005 May 02
1
newbie ifelse matrix question
...last week, but no luck so far.
Here is my syntax and error
> data1<-read.table("testR_data",na.string="0.000000")
> dim(data1)
[1] 20 204
# Find sd of rows, then multiply * 3
> sd_data3<-apply(data1[,5:204],1,sd,na.rm=TRUE)*3
# Attach sd_data3 to data1
> sd_and_data1<-cbind(sd_data3,data1)
# Replace values >= 3 SDs with NA
> sd_and_data1[,6:205]<-ifelse(abs(sd_and_data1[,6:205])<=sd_and_data1[,1],sd_and_data1[,6:205], NA)
Warning message:
provided 4000 variables to replace 200 variables in: "[<-.data.frame"(`*tmp*`, , 6:205, value =...