[R] modifying only certain rows in a data-frame

jim holtman jholtman at gmail.com
Sun May 30 02:15:50 CEST 2010


try something like:

r$deltact[r$time == '0h'] <- 0

On Sat, May 29, 2010 at 7:50 PM, ANJAN PURKAYASTHA
<anjan.purkayastha at gmail.com> wrote:
> Hi,
> I have a data-frame r (shown below is a subset) with the following column
> names:
> date    time    sample    vct    norm    hct    deltact
>
> $time has 8 levels: 0h, 0.5h, .....24h. $deltact holds real numbers.
> I want to subset this dataframe by the levels of $time.  For all the rows
> which have r$time == "0h" I would like to convert the present value of
> r$deltact to 0.
> Any pointers to a simple method to accomplish would be greatly appreciated.
>
> TIA,
> Anjan
>
>
> --
> ===================================
> anjan purkayastha, phd.
> research associate
> fas center for systems biology,
> harvard university
> 52 oxford street
> cambridge ma
> phone-703.740.6939
> ===================================
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?



More information about the R-help mailing list