I have loaded as many text files as possible from a folder in my global environment
Now I want to merge them into one dataframe
As an example I mention 3 data set and a desire output
df1<- structure(list(V1 = structure(c(9L, 15L, 3L, 2L, 12L, 7L, 8L,
10L, 4L, 5L, 1L, 6L, 16L, 11L, 14L, 13L, 17L), .Label = c("ASS1",
"CLCN4", "CXorf56", "DNAL4", "ELAC2", "IPP", "MMP15", "MTMR14",
"NIPSNAP3B", "NPR1", "POLR2J", "PWP2", "RGS4", "SEC23IP", "TF",
"TMEM59", "UQCRC1"), class = "factor"), V2 = c(3.771321309, 4.121988898,
5.555893632, 4.586876086, 6.279490572, 6.004261107, 6.613729673,
5.185145989, 5.63567329, 5.785365957, 9.018526719, 5.734111507,
9.809870554, 9.09813781, 5.643864005, 4.540559556, 9.375200415
)), .Names = c("V1", "V2"), class = "data.frame", row.names = c(NA,
-17L))
second df like below
df2<- structure(list(V1 = structure(c(2L, 3L, 1L), .Label = c("CXorf56",
"NIPSNAP3B", "TF"), class = "factor"), V2 = c(3.771321309, 4.121988898,
5.555893632)), .Names = c("V1", "V2"), class = "data.frame", row.names = c(NA,
-3L))
and the third df like below
df3<- structure(list(V1 = structure(c(6L, 7L, 11L, 17L, 3L, 2L, 14L,
9L, 10L, 12L, 4L, 5L, 1L, 8L, 18L, 13L, 16L, 15L, 19L), .Label = c("ASS1",
"CLCN4", "CXorf56", "DNAL4", "ELAC2", "EMX2", "FUS", "IPP", "MMP15",
"MTMR14", "NIPSNAP3B", "NPR1", "POLR2J", "PWP2", "RGS4", "SEC23IP",
"TF", "TMEM59", "UQCRC1"), class = "factor"), V2 = c(4.037370833,
6.933306871, 3.771321309, 4.121988898, 5.555893632, 4.586876086,
6.279490572, 6.004261107, 6.613729673, 5.185145989, 5.63567329,
5.785365957, 9.018526719, 5.734111507, 9.809870554, 9.09813781,
5.643864005, 4.540559556, 9.375200415)), .Names = c("V1", "V2"
), class = "data.frame", row.names = c(NA, -19L))
The three of them have some names in common and some not
I want to make a general name and then put zero values for those data that they dont have those names
a desire output is like below
output<- structure(list(V1 = structure(c(11L, 6L, 7L, 12L, 18L, 3L, 2L,
15L, 9L, 10L, 13L, 4L, 5L, 1L, 8L, 19L, 14L, 17L, 16L, 20L), .Label = c("ASS1",
"CLCN4", "CXorf56", "DNAL4", "ELAC2", "EMX2", "FUS", "IPP", "MMP15",
"MTMR14", "names", "NIPSNAP3B", "NPR1", "POLR2J", "PWP2", "RGS4",
"SEC23IP", "TF", "TMEM59", "UQCRC1"), class = "factor"), V2 = structure(c(19L,
1L, 1L, 2L, 3L, 7L, 5L, 13L, 12L, 14L, 6L, 8L, 11L, 15L, 10L,
18L, 16L, 9L, 4L, 17L), .Label = c("0", "3.771321309", "4.121988898",
"4.540559556", "4.586876086", "5.185145989", "5.555893632", "5.63567329",
"5.643864005", "5.734111507", "5.785365957", "6.004261107", "6.279490572",
"6.613729673", "9.018526719", "9.09813781", "9.375200415", "9.809870554",
"df1"), class = "factor"), V3 = structure(c(5L, 1L, 1L, 2L, 3L,
4L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = c("0",
"3.771321309", "4.121988898", "5.555893632", "df2"), class = "factor"),
V4 = structure(c(20L, 2L, 15L, 1L, 3L, 7L, 5L, 13L, 12L,
14L, 6L, 8L, 11L, 16L, 10L, 19L, 17L, 9L, 4L, 18L), .Label = c("3.771321309",
"4.037370833", "4.121988898", "4.540559556", "4.586876086",
"5.185145989", "5.555893632", "5.63567329", "5.643864005",
"5.734111507", "5.785365957", "6.004261107", "6.279490572",
"6.613729673", "6.933306871", "9.018526719", "9.09813781",
"9.375200415", "9.809870554", "df3"), class = "factor")), .Names = c("V1",
"V2", "V3", "V4"), class = "data.frame", row.names = c(NA, -20L
))