0

With this we can create a data frame with days having the start day:

  dataframe = seq(as.Date("2000-09-01"), by="days", length=11)

If we have already a dataframe which has values can we do the same?

4

1 回答 1

2

That actually creates a Date vector, not a data frame.

x <- seq(as.Date("2000-09-01"), by="days", length=11)
class(x)
# [1] "Date"

If you define the starting date as the earliest date (i.e., the minimum date), then use min:

min(x)
# [1] "2000-09-01"

But if you're looking for the first element in the vector (which is also the earliest in your case, but of course it doesn't have to be), then grab it by its index:

x[1]
# [1] "2000-09-01"
于 2013-09-07T13:20:09.440 回答