[R] Setting elements in data frame
Kaspar Pflugshaupt
pflugshaupt at cirsium.ethz.ch
Thu Feb 22 14:34:15 CET 2001
On Thursday 22 February 2001 14:17, Peter Dalgaard BSA wrote:
> This seems to work, save for a (sort of spurious) warning that 6000 is
> not a valid replacement value for the factor column:
>
> x[,]<-lapply(x,function(z){z[z==6]<-6000;z})
>
> (Why the comma? Search me...)
>
Works also without the comma:
x <- data.frame(lapply(x,function(x) {x[x==6]<-6000;x}))
but still gives the warning.
Kaspar
--
Kaspar Pflugshaupt
Geobotanical Institute
ETH Zurich, Switzerland
http://www.geobot.umnw.ethz.ch
mailto:pflugshaupt at geobot.umnw.ethz.ch
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list