0
  1. I have a dataset that contains four different countries and measures child labor and other characteristics. I have one dataset that already contains rounds 2, 3, and 4 (OC234) merged together (thanks to my teacher). However, I would also like to include rounds 1 and 6 in my analysis. All of the data contain the child's ID (childid) which would be the ideal way to join them. One of the issues I am facing is that for round 1, the data for each country is in a separate dataset, and they do not all contain the same number of variables. I have tried to merge the datasets together but I have been unsuccessful. Can anyone offer any advice? Just for reference, the data with rounds 2, 3, and 4 looks like this: Data

I tried using functions like merge, rbind, or cbind, but i am not getting it in a way that shows rounds 1, 2, 3, and 4 consecutively as shown in the screenshot, which is my goal.

Phil
  • 7,287
  • 3
  • 36
  • 66
pure24
  • 19
  • 1
  • `dplyr::left_join(df1, df2, by = "childid")` https://dplyr.tidyverse.org/articles/two-table.html#mutating-joins – Phil Aug 22 '23 at 00:09
  • `rbind`, followed by `order` or `dplyr::arrange` to get them in order afterward. If they've got different numbers of variables then use bracket subsetting or `dplyr::select` to get only the necessary ones. I don't think a left join is the goal here, @Phil. – Dubukay Aug 22 '23 at 00:34
  • 1
    We cannot read data into R from images. Please [make this question reproducible](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) by including a small representative dataset in a plain text format - for example the output from `dput(yourdata)`, if that is not too large. – neilfws Aug 22 '23 at 01:58
  • You have to give us a small dataset, which represents minimally your problem. You can use R's `dput()` function to extract a small subset of your datasets. – AnilGoyal Aug 22 '23 at 04:01

0 Answers0