0

I'm new to Stack Overflow so I apologize if I'm not asking this question right. I am working in RStudio and have two data frames with the same variables or columns (see below). but one data frame is adding cases. In this instance, data from females only. How can I do that?

Data frame 1

ID  Gender  v1  v2  v3
1     m     2    3   4
2     m     6    1   0
4     m     2    2   1

Data frame 2
ID  Gender  v1  v2  v3
10     f     7   3   4
11     f     5   2   0
3      f     2   2   1

#Combined data frame
ID  Gender  v1  v2  v3
1      m     2   3   4
2      m     6   1   0
4      m     2   2   1
10     f     7   3   4
11     f     5   2   0
3      f     2   2   1
Nick
  • 21
  • 6
  • 1
    are you asking how to combine them? `rbind(df1, df2)` – spinodal Apr 12 '18 at 23:46
  • You don't want to `merge` you want to `rbind(df1,df2)` or `dplyr::bind_rows(df1,df2)` – Matias Andina Apr 12 '18 at 23:46
  • 1
    See `?rbind` - try `rbind(df1, df2)` - also search for row binding in R. You may also want to look into `dplyr::bind_rows()`. – JasonAizkalns Apr 12 '18 at 23:46
  • Thanks! That was helpful. I'm slowly working my way through Wickham's R for Data Science but I feel like it talks more about join function rather than bind function. Is it possible to do an rbind command that adds new columns from one data frame to another? – Nick Apr 15 '18 at 02:58

0 Answers0