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

R. Michael Weylandt michael.weylandt at gmail.com
Fri May 25 16:15:14 CEST 2012


There aren't "empty" values in R..... nor is it likely you have a
matrix of this form, but perhaps a data frame.

Perhaps this works for you,

If "dat" is the name of your data.frame,

dat[dat$AGE == 30,"TRUE/FALSE"] <- TRUE

Next time do use dput() to give a reproducible example of your data --
if it's very large, just limit it to the first 30 rows or so with
dput(head(dats, 30))

Michael

On Fri, May 25, 2012 at 9:43 AM, Rantony <antony.akkara at ge.com> wrote:
> Hi,
>
> Here i have been a matrix like this,
>
> *NAME    AGE   PALCE                TRUE/FALSE*
> ABC         20      INDIA
> XYZ         30       FRANCE
> PQR        40       USA
> MNO     30        KENIYA
> DEF        25        AUSTRALIA
>
> 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 = 30*.
> 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                     TRUE
> PQR        40       USA
> MNO     30        KENIYA                      TRUE
> DEF        25        AUSTRALIA
>
>
> Immediate Help Requied.
>
> Your,
> Antony.
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Hash-Table-Select-and-Change-Data-iniside-Matrix-tp4631312.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