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.html Sent from the R help mailing list archive at Nabble.com.
Hi> [R] Moving data in a dataset > > 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??What is cell? And how do you want to "move" data? BTW. What type of data? Matrix, data frame, vector, list, ... I can imagine for instance> mat<-matrix(rnorm(4), 2,2) > mat[,1] [,2] [1,] -1.1336516 0.8050537 [2,] 0.9676428 0.9532624> mat[2,2]<-mat[1,1] > mat[,1] [,2] [1,] -1.1336516 0.8050537 [2,] 0.9676428 -1.1336516>But it seems to me that this is not what you want. Regards Petr> > Thanks for your help!! > > Vi > > -- > View this message in context: http://r.789695.n4.nabble.com/Moving-data- > in-a-dataset-tp3812083p3812083.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 guidehttp://www.R-project.org/posting-guide.html> and provide commented, minimal, self-contained, reproducible code.
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.
Maybe Matching Threads
- how to use by function
- Time Series-like barplot?
- More elegant way of excluding rows with equal values in any 2 columns?
- output and save multiple dataset from a function: sorry I could not figure out this....
- Finding functions of large dataset for numerical integration