Hi r-help-boun...@r-project.org napsal dne 28.01.2010 09:21:31:
> > close, > > So I have a vector, lets say > > [1] 1.5 1.2 > > And a matrix > [,1] [,2] > [1,] 1.9 1.3 > [2,]-.2 2 > > I want to somehow use the first number in my vector(1.5) and compare this > number to my whole first column. So I want to see how many times the numbers > in column 1<1.5 which should be 1 in this case. Now for the other number, we > compare 1.2. We get 0. So I need a vector to have these results like > > [1] 1 0 If you change your matrix to data frame and you can use mapply > colSums(mapply(function(x,y) x<y, daf, vec)) X1 X2 1 0 > > -- > View this message in context: http://n4.nabble.com/If-then-test-tp1322119p1336898.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. ______________________________________________ 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.