Dear all I have a table as that.
test<-matrix(data=rnorm(100),ncol=10)
and I want to find the values that are below my thresholdthreshold<- -0.5and
replace them with a -1 instead.
I can of course write a double nested for loop to check one by one elementif
(test[i,j]<= threshold) test[i,j]<- -1
but that would be rather inneficient sice I have very large tables.
Does R offer any "automation" for matrix data types?
I would like to thank you in advance for your replyRegardsAlex
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.