a <- c("a", NA, "b", NA, "c")
b <- c("x", "y", NA, NA, "z")
## turns NAs into the string "NA"
paste(a, b)
## keeps NAs in the result
pasteMat(a, b)
pasteMat(cbind(a, b)) # same
dts <- c("1989-09-28", NA, "2004-08-30", "1990-02-09")
tms <- c( "23:12:55", "10:34:02", NA, "11:18:23")
paste(dts, tms)
## this throws error (since NAs are converted to the string NA):
## timeDate(paste(dts, tms), FinCenter = "Europe/Zurich")
## these work
td1 <- timeDate(pasteMat(cbind(dts, tms)), FinCenter = "Europe/Zurich")
td2 <- timeDate(pasteMat(dts, tms), FinCenter = "Europe/Zurich")
identical(td1, td2)
td1
Run the code above in your browser using DataLab