for loop to subset data.frame in R
I have two data frames one with 94 rows and 167 columns (df_1) and the other one with 94 rows and 1 column (df_2) and I would like to do 167 different data frames with each column of the first data frame and the same column of the second data frame
for (i in seq_len(ncol(df_1))){
df_[[i]] <- data.frame(df_1[sort(rownames(df_1)),i,df_2[sort(rownames(df_2)),])
}
Can someone help me with this?
• 5,821 views
•
link
0 answers
No answers yet.
Log in to answer this question.
Hello erick_rc93!
We believe that this post does not fit the main topic of this site.
Pure programming, not strictly bioinformatics, try Stack Overflow
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!