I can initialize a data.frame via
df <- data.frame(a=numeric(), b=character())
But how do I define a column of type POSIXct?
df <- data.frame(a=numeric(), b=character(), c=POSIXct())
won't work.
You can try
df <- data.frame(a=numeric(), b=character(), c=as.POSIXct(character()))
Similarly, you can create a POSIXct
column of NA
s in a data frame with > 0 rows by creating a new column with as.POSIXct(NA)
.