Hi every one. I'm learning how to use sapply (and other function of this family).
Here's what I'm trying to do. I have a vector of lets say 5 elements. I also have a matrix of nX5. I would like to know how many element by column are inferior to each element of my vector. On this example: v = c(1:5) M = matrix(3,2,5) I would like to have a vector at the end which give me 0 0 0 2 2 because in my matrix M, there's 2 row at my columns 4 and 5 that have number < than values 4 and 5 respectively. This is pretty simple to do with a loop, but I would like to know how to do it with sapply. I hope I have been clear enough. Tx in advance. Phil -- View this message in context: http://r.789695.n4.nabble.com/sapply-help-tp4355092p4355092.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list 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.