[R] Hash Table - Select and Change Data iniside Matrix Using "Between"

R. Michael Weylandt michael.weylandt at gmail.com
Mon May 28 18:40:37 CEST 2012


I already answered this. Don't double post questions.

On Mon, May 28, 2012 at 10:01 AM, Rantony <antony.akkara at ge.com> wrote:
> Hi,
>
> Here i have been an matrix like this,
>
> *NAME    AGE   PALCE                TRUE/FALSE*
> ABC         20      INDIA
> XYZ         30       FRANCE
> PQR        40       USA
> MNO     30        KENIYA
> DEF        25        AUSTRALIA
> GTY        34       CANADA
> BNH      38        JAPAN
>
> Here, *TRUE/FALSE  *Column containing empty values.
>
> So my requirement what is, need to change all the TRUE/FALSE column value
> into "TRUE" where *AGE= 32*.
> Note :- i dont want to use any loop and do. Main intension is avoid loop,bcz
> there is a bulk of data.
>
> Final Matrix should be like this
> *NAME    AGE   PALCE                TRUE/FALSE*
> ABC         20      INDIA
> XYZ         30       FRANCE
> PQR        40       USA
> MNO     30        KENIYA
> DEF        25        AUSTRALIA
> GTY        34       CANADA                 TRUE
> BNH      38        JAPAN                     TRUE
>
> and finally got 1 solution like this,
>
> If "dat" is the name of your data.frame,
> dat[dat$AGE == 30,"TRUE/FALSE"] <- TRUE
>
> But how will use if i want to change to TRUE, *AGE between *30-to-40  ?
>
>
> Immediate Help Requied
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Hash-Table-Select-and-Change-Data-iniside-Matrix-Using-Between-tp4631582.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at 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.



More information about the R-help mailing list