[R] Changingvalues in data frame

Thomas Petzoldt thpe at hhbio.wasser.tu-dresden.de
Thu Mar 11 13:05:21 CET 2004


Hello Frank,

does the following example, what you want?

Thomas P.

## some test data
x <- data.frame(matrix(rnorm(72*10, mean=50, sd=20), ncol=10))

me <- colMeans(x)
sd <- apply(x, 2, sd)

coff <- me + 2*sd

# see ?t and ?pmax
x2 <- t(pmin(t(x),coff))

# test it
x-x2




More information about the R-help mailing list