Message-ID: <CAAmySGMHt96EtvjqxhJ23Y_mQtiN0zWpQgFaH6tbq8bEFFpv2Q@mail.gmail.com>
Date: 2012-05-28T16:40:37Z
From: R. Michael Weylandt
Subject: Hash Table - Select and Change Data iniside Matrix Using "Between"
In-Reply-To: <1338213712857-4631582.post@n4.nabble.com>
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.