How get value from specific columns and rows?
I have two data files one of them with 329 rows and 2116 columns and my second file is contain just row names and column names.Part of my data as below:
File 1:
X.1.10 X.1.1 X.1.2 X.1.3 X.1.4
ENSG00000001561_6_46111013_46114436 0.7900822 0.8352197 0.6585054 0.8533949 0.7939489
ENSG00000003249_16_90071273_90074169 0.9035250 0.9410830 0.9158669 0.8937532 0.8775196
ENSG00000005513_16_1034701_1036979 0.7333333 0.7654736 0.8371955 0.7660987 0.8617606
ENSG00000006432_14_71189243_71197581 0.9099154 0.8739031 0.8736289 0.8980691 0.8843309
ENSG00000007372_11_31806340_31811567 0.9569841 1.0000000 1.0000000 1.0000000 0.9115044
File 2:
sample
ENSG00000001561_6_46111013_46114436 X.1.1
ENSG00000003249_16_90071273_90074169 X.1.3
ENSG00000007372_11_31806340_31811567 X.1.4
I like to get each value from (file 1)for each related sample from file 2 base on same rows between two files. Indeed I like below output:
output:
ENSG00000001561_6_46111013_46114436 X.1.1 0.8352197
ENSG00000003249_16_90071273_90074169 X.1.3 0.8937532
ENSG00000007372_11_31806340_31811567 X.1.4 0.9115044
• 977 views
•
link
1 answer
This is really just an R question, but see the match function and dplyr::inner_join().
• 0 views
•
link
Log in to answer this question.
Hello star!
We believe that this post does not fit the main topic of this site.
This has got not much to do with bioinformatics. Please ask stackoverflow - in fact, google first. I'm pretty sure this would have been answered already.
For this reason we have closed your question. This allows us to keep the site focused on the topics that the community can help with.
If you disagree please tell us why in a reply below, we'll be happy to talk about it.
Cheers!
I agree that this is an R question rather than bioinformatics (nothing other than row names being similar to ensembl ids qualifies it, and that is not enough), and has been answered well elsewhere: https://stackoverflow.com/questions/1299871/how-to-join-merge-data-frames-inner-outer-left-right What you want is likely R data frame behaving like a SQL table joins, being able to make SQL like JOIN is of course versatile in many fields (including bioinformatics)