This is a test version of Biostars. For the public version, visit https://www.biostars.org.
merging data frames in r

I want to merge two data.frames in R, the first one is a data frame with 50,000 rows and 95 columns and the second one has only 1 row and 95 columns, I'm using the rbind function, but I'm not sure how this function works, for example, Is necessary that both colnames in data frames are sorted or it doesn't matter ?

   data_2 <- data.frame(1:50000, 1:95 ) 

vector <- read.table(file = "vector_binary.csv",header = T,sep = ",",row.names = 1,check.names = F)
        vector_t <- data.frame(t(vector),check.names = F)
        dummy_variable_1 <- data.frame(vector_hip_t[order(colnames(data_2))],check.names = F) 
        row.names(dummy_variable_1) <- "1_dummy.faa"

        data_2 <- rbind(data_2,dummy_variable_1)
        write.csv(x = data_2,file = "pangenome_matrix_t0.tr_3.csv")
r

column names do not need to be sorted, they only need to exist in both dataframes. rbind(df1, df2) would return a new dataframe with the rows of df2 appended to the bottom of df1

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!

0 answers

No answers yet.

Log in to answer this question.