I have two dataframes that I need to combine. I don't have one single unique identifier so I have been using a combination of most of my columns. I have been using:
df1 <- merge(x=broth, y=microresp, by.x= c("Plate", "Time", "Isolate", "Treatment", "Replicate"), by.y= c("Plate", "Time", "Isolate", "Treatment", "Replicate"), all.x=T)
I have switched out all.x for all.y and all=T and F. Every time I try to combine these dataframes I keep getting extra rows in my final dataframe. All of my columns in both dataframes are identical except for 1 column in each. My samples in each datafram are not in the same order all the way through, so I cannot use cbind. I have also tried to only sortby.x or by.y and nothing seems to fix my issue. My dataframe is far too large to go back and manually remove them. Does anybody have a solution to either remove these rows, or not have them be there when I merge to begin with? I've seen some people with a similar question but none of their solutions have been working for me.
I've but the start of what my dataframes look like below:
Treatment Plate Time OD wellID Isolate Replicate
<chr> <chr> <chr> <dbl> <chr> <chr> <int>
1 dilLB 0_90 t0 0.037 A1 broth 1
2 dilLB 0_90 t0 0.037 A2 broth 2
3 dilLB 0_90 t0 0.038 A3 broth 3
4 fullLB 0_90 t0 0.037 A4 0 4
5 fullLB 0_90 t0 0.037 A5 0 5
6 fullLB 0_90 t0 0.037 A6 0 6
Treatment Plate Time Absorbance wellID Isolate Replicate
<chr> <chr> <chr> <dbl> <chr> <chr> <int>
1 fullLB 0_90 t0 1.41 A1 90 12
2 fullLB 0_90 t0 1.40 A2 90 11
3 fullLB 0_90 t0 1.47 A3 90 10
4 fullLB 0_90 t0 1.5 A4 broth 9
5 fullLB 0_90 t0 1.42 A5 broth 8
6 fullLB 0_90 t0 1.43 A6 broth 7