Thanks a lot!
--
View this message in context:
http://r.789695.n4.nabble.com/a-question-about-replacing-the-value-in-the-data-frame-tp2532010p2533036.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org mailing list
ht
Hello Karena,
dat <- as.data.frame(matrix(sample(0:2, 400, replace = TRUE), ncol = 4000))
# if it is a data frame and has to stay that way
# the option that comes to mind is apply()
apply(dat, 2, function(x) {ifelse(x==2, 1, x)})
# if it can be or can be converted to a matrix
dat2 <- as.matr
2 matches
Mail list logo