Dear Jonathan, Thanks a lot for your help! That works pretty well!
Best wishes, Wei On 7/15/10 5:52 PM, Jonathan Flowers wrote: > Hi, > > What if you create two data frames, then merge them by gene id. > > If your data is in a data frame called "dframe"... > > df1 <- subset(dframe,select=c("id2c","2c")) > df2 <- subset(dframe,select=c("id1c","1c")) > > merged <- merge(df1,df2,by.x="id2c",by.y="id1c",all=TRUE) > > plot(merged$1c,merged$2c) > > Cheers, > > Jonathan > > > On Thu, Jul 15, 2010 at 5:12 AM, Yanwei Tan > <t...@nbio.uni-heidelberg.de <mailto:t...@nbio.uni-heidelberg.de>> wrote: > > Dear all, > > I would like to make a scatter plot using "plot" function. I have two > sample 1c and 2c, the 1st and 3rd are the ID of each gene, the 2nd and > 3rd are the values. But as you can see some genes are not in the same > row, i.e: ENSMUSG00000001020 is in the 4th row in sample 2c and > 7th row > of the sample 1c. But I have nearly 1000 genes, I can not edit > the data > manually to fit the "plot" function. > > Does "Plot" can automatically recognize every gene in different row of > samples? If I simply do "plot(2c,1c)", then I guess the dot about gene > ENSMUSG00000001020 would be (0.122112211, 0.655010678 ) instead of > (0.122112211, 0.15301479). > > Can someone give me some hint? > > With many thanks in advance! > > Best wishes, > Wei > > > id2c 2c id1c 1c > ENSMUSG00000000184 0.345889139 ENSMUSG00000000184 > 0.601580659 > ENSMUSG00000000202 0.310589755 ENSMUSG00000000202 > 0.422453875 > ENSMUSG00000000531 1.945122637 ENSMUSG00000000355 > 0.633385261 > ENSMUSG00000001020 0.122112211 ENSMUSG00000000567 > 0.655010678 > ENSMUSG00000001228 0.157001414 ENSMUSG00000000948 > 0.785187729 > ENSMUSG00000001403 0 ENSMUSG00000000957 0.643804965 > ENSMUSG00000001435 1.865292034 ENSMUSG00000001020 > 0.15301479 > ENSMUSG00000001473 2.156209643 ENSMUSG00000001025 > 0.43609215 > ENSMUSG00000001508 3.736633663 ENSMUSG00000001228 > 0.087437023 > ENSMUSG00000001604 3.846534653 ENSMUSG00000001403 > 0.045904437 > ENSMUSG00000001655 NA ENSMUSG00000001435 1.3497589 > ENSMUSG00000001773 0.10990099 ENSMUSG00000001506 > 0.688566553 > ENSMUSG00000001864 0.212711594 ENSMUSG00000001555 > 0.571640157 > ENSMUSG00000002055 0.224287735 ENSMUSG00000002055 > 0.393466602 > ENSMUSG00000002076 13.18811881 ENSMUSG00000002076 > 13.77133106 > ENSMUSG00000002274 0.318134445 ENSMUSG00000002265 > 0.659467911 > > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org <mailto: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. > > [[alternative HTML version deleted]] ______________________________________________ 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.