1

I have a data.frame something like this:

D = data.frame(a = c(NA,"2015-09-10"), b = c("2016-09-30",NA))

Here I'm not sure, whether this actually perfectly represents my data, because there are two columns of dates (date-time format, POSIXlt).

           a          b
1       <NA> 2016-09-30
2 2015-09-10       <NA>

Each column has entries/NA's, there are no double entries. I want to combine these two. So far I tried every version of paste() or merge() I am aware of (though my knowledge is restricted).

The question is very closely related to Combine two columns in R, still I cannot make it work, because rowMeans() only works on numerics.

Marco
  • 2,368
  • 6
  • 22
  • 48
  • 1
    Essentially https://stackoverflow.com/questions/43038371/merge-multiple-date-columns-into-one/43038812 – thelatemail Oct 26 '17 at 08:03
  • 1
    Relevant line from the duplicated thread: `do.call(pmin, c(dat, na.rm=TRUE) )` – LAP Oct 26 '17 at 08:11
  • 1
    Thank you so much, `do.call(pmin, c(dat[c("col1","col2","col3")], na.rm=TRUE) )` did the job for me, hence I had a bigger data.frame. – Marco Oct 26 '17 at 08:39

0 Answers0