[R] How to replace range of data in a dataframe

Camilo Mora cmora at dal.ca
Wed Feb 15 10:38:08 CET 2012


Hi:
I wonder if anyone may know the answer to this question:

COnsider the following data frame (DF):

ColumnA   ColumnB   ColumnC
   a         d         d
   s         s         e
   e         r         e
   y         w         y
   t         u         i
   q         e         l

What I need is to replace rows 1 to 3 in ColunmC for a random number?
I tried DF$ColumnC[DF$ColumnC [1:3]] <- .Random.seed[1:3]
but does not work.

It may be trivial but have not been able to find a solution.

Thanks,
Camilo



More information about the R-help mailing list