Are they objects of class "matrix" or "data.frame"? You seem to make reference to both, but know there is a difference.

Try:

junk[junk > 5] <- 5



Grey Moran wrote:
Hello,

I have some rather large matrices.  Is there a way (without having to
loop) to cap all the values of a data frame to a given ceiling?
E.g.
junk <- cbind(c(1,2,3,4,5),c(2,4,6,8,10))
junk
     [,1] [,2]
[1,]    1    2
[2,]    2    4
[3,]    3    6
[4,]    4    8
[5,]    5   10

" replace anything over the value of 5 with 5..."

Thank you all,

Grey

______________________________________________
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.

Reply via email to