Re: [R] Matching rows in a Data set? I'm Stuck!!
I have not explained this properly. I meant to say if the ID vales of the rows in each file match, print the data into a new dataframe with this structure ID DATA1 2345 VALUE1 VALUE2 where value1 is from the first dataset and value2 is from the 2nd -- View this message in context: http://n4.nabble.com/Matching-rows-in-a-Data-set-I-m-Stuck-tp1576432p1576440.html Sent from the R help mailing list archive at Nabble.com. __ R-help@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.
[R] Matching rows in a Data set? I'm Stuck!!
Hi, I'm having (yet another) problem with R. I have a few data sets that have this sort of format dataset1 ID DATA 1234 value 2345 value 3456 value dataset2 ID DATA value 2345 value value What i really want to do is write an R script that says "if the ID of dataset1 and 2 match (2nd row), print out that whole row into a new dataset3". No idea how to do that though. Normally I would just write out the files to a txt file then write a perl script that would do just that. However these files are HUGE and perl will take forever to do this!! I'm hoping theres a quicker solution in R... Any help appreciated -- View this message in context: http://n4.nabble.com/Matching-rows-in-a-Data-set-I-m-Stuck-tp1576432p1576432.html Sent from the R help mailing list archive at Nabble.com. __ R-help@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.
Re: [R] Matching rows in a Data set? I'm Stuck!!
Unfortunately its complaining that 'by.x' and 'by.y' specify different numbers of columns'. I don't really see why that matters if your matching tbh... I'm having a few problems. Merge is definitely what I want but my files are way too big and i'm having memory trouble. Plus I figures out the ID column isn't unique but I guess i can just use by.y="anotheridentifyingcolumn" to get around that. -- View this message in context: http://n4.nabble.com/Matching-rows-in-a-Data-set-I-m-Stuck-tp1576432p1576544.html Sent from the R help mailing list archive at Nabble.com. __ R-help@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.
Re: [R] Matching rows in a Data set? I'm Stuck!!
Thanks! I'm just trying to do it now but having issues with memory... test <- merge(file1, file2, by.x = "col1") will this give me the output I was hoping for ID VALUE1 VALUE2 ? Thanks -- View this message in context: http://n4.nabble.com/Matching-rows-in-a-Data-set-I-m-Stuck-tp1576432p1576523.html Sent from the R help mailing list archive at Nabble.com. __ R-help@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.
[R] Mutliple sets of data in one dataset....Need a loop?
Hi I'm hoping someone can help me I am a relative newbie to R. I have data that is in a similar format to this... Experiment Score1 Score2 X -0.85 -0.02 X -1.21 -0.02 X 1.05 0.09 Y -1.12 -0.07 Y -0.27 -0.07 Y -0.93 -0.08 Z 1.1 -0.03 Z 2.4 0.09 Z -1.0 0.09 Now I can easily have a look at the overall correlation of score 1 and 2 by doing this plot(data[,2], data[,3]) or fit <- lm(data[,2] ~ data[,3] BUT! I really want to look at the correlations within each experiment type so ideally a multiple plot per page of each correlation within an experiment - and/or a way of looping through the data to get the simple linear regression for each experiment for scores 1 and 2. This looks like an easy example but I have thousands of results so it would be really hand to find away of doing this quickly!! Let me know if you need more explaining... E -- View this message in context: http://n4.nabble.com/Mutliple-sets-of-data-in-one-dataset-Need-a-loop-tp1018503p1018503.html Sent from the R help mailing list archive at Nabble.com. __ R-help@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.
Re: [R] Mutliple sets of data in one dataset....Need a loop?
Hi Thanks for all your help Its a little difficult to follow those examples as all seem so different and its hard to see how I do what I want to my data from the help files but i'll try... -- View this message in context: http://n4.nabble.com/Mutliple-sets-of-data-in-one-dataset-Need-a-loop-tp1018503p1049653.html Sent from the R help mailing list archive at Nabble.com. __ R-help@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.