How can I combine rows within the same data frame in R (based on duplicate values under a specific column)?
问题 Sample of 2 (made-up) example rows in df: userid facultyid courseid schoolid 167 265 NA 1678 167 71111 301 NA Suppose that I have a couple hundred duplicate userid like in the above example. However, the vast majority of userid have different values. How can I combine rows with duplicate userid in such a way as to stick to the column values in the 1st (of the 2) row unless the first value is NA (in which case the NA will be repopulated with whatever value came from the second row)? In essence