[R] Moving data in a dataset

MacQueen, Don macqueen1 at llnl.gov
Wed Sep 14 20:49:27 CEST 2011


Spreadsheets have cells, but R does not. So you will have to be much more
specific.

The closest I can come would be like this example:

If you want to copy the value that is in the 3rd row, 2nd column to the
4th row, 1st column, then
  mydata[4,1] <- mydata[3,2]
But that is a copy, not a move (and whatever was in "cell" 4,1 will be
gone.
To leave the 3rd row, 2nd column "empty", then next you would do
  mydata[3,2] <- NA

However, this example is only a guess, and it only makes sense if your
data is stored in a matrix or data frame. But you haven't said how your
data is stored.

Please read and follow the posting guide, as requested at the bottom of
every message to r-help. You will receive better help if you do. You
should probably also download and read one of the introductory manuals
from CRAN, if you have not already. It will explain many basic concepts.

-Don

-- 
Don MacQueen

Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062





On 9/14/11 1:18 AM, "sikelos" <sikelos1986 at hotmail.it> wrote:

>Dear all,
>
>i'm relatively new to R and so my question could be considered stupid.. By
>the way..
>
>I have a dataset and i would like to move data from a cell to another
>specific cell. Hw can i do??
>
>Thanks for your help!!
>
>Vi
>
>--
>View this message in context:
>http://r.789695.n4.nabble.com/Moving-data-in-a-dataset-tp3812083p3812083.h
>tml
>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