Choose specific column from a list of dataframes in Rstudio
1
0
Entering edit mode
3.7 years ago

Hi everyone, In the last couple of days, I was trying to complete some data analysis for a set of samples I ran a pipeline in Galaxy. I got the tabular file and wrote the R script successfully, getting the lists I wanted to have. https://pasteboard.co/Jm5EFR7.png https://pasteboard.co/Jm5F3BT.png

I was then trying to refine the script by choosing a specific column that worked for dataframe alone

FPKMs$SRR11517725$`Gene ID`

I wonder if there is a different way to express the above script for all the dataframes in my list, something like....

FPKMs[1:8]'Gene ID'

I tried many alternatives but I couldn't find that could work.

R RNA-Seq • 679 views
ADD COMMENT
0
Entering edit mode
ADD REPLY
3
Entering edit mode
3.7 years ago
Ram 43k

Use lapply

lapply(FPKM, function(x) x$`Gene ID`)
ADD COMMENT
0
Entering edit mode

Thank you so much RamRS.

ADD REPLY
0
Entering edit mode

If an answer was helpful, you should upvote it; if the answer resolved your question, you should mark it as accepted. You can accept more than one answer if they all work.

Upvote|Bookmark|Accept

ADD REPLY

Login before adding your answer.

Traffic: 1957 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6