Re: [R] Finding the position of a variable in a data.frame

From: Gerald Jansen <gerald.jansen_at_newpage.ca>
Date: Thu 03 Aug 2006 - 08:53:02 EST

On Wed, 02 Aug 2006 17:12:53 -0400, Chuck Cleland wrote:
> Why not do it this way?
>
> Df$bat <- replace(Df$bat, Df$bat >=50, 100)

Is that any different, performancewise, than the following?

Df$bat[Df$bat >= 50] <- 100

Gerald Jansen

...
John Kane wrote:
> Simple example
>
> cat <- c( 3,5,6,8,0)
> dog <- c(3,5,3,6, 0)
> rat <- c (5, 5, 4, 9, 0)
> bat <- c( 12, 42, 45, 32, 54)
>
> Df <- data.frame(cbind(cat, dog, rat, bat))
...



R-help@stat.math.ethz.ch 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. Received on Thu Aug 03 10:07:17 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 03 Aug 2006 - 12:18:10 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.