iso8601todataframe {iso8601}R Documentation

Split Date, Time and DateTime ISO8601 strings into their elements

Description

Split Date, Time and DateTime ISO8601 strings into their elements

Usage

iso8601todataframe(
  x,
  transformdate = c("no", "toyearmonthday", "toyearday"),
  ndigitsyear = 4L
)

Arguments

x

character vector of date, time or date-time strings

transformdate

Transform the date to the given format. This also immplies that missing parts of the date are replaces by values of 1.

ndigitsyear

Number of digits used to encode the year. This should be an integer with values >= 4 with the same length as x or length one. When it is a vector with length greater than one, a different value is used for each element of x.

Value

Returns a data.frame with possibly the following columns:

type

Type of ISO 8601 string. A factor with the following possible values: 'Date', 'Time', 'Datetime', 'Duration', 'Interval', 'RepeatingInterval'.

year

Year.

month

Month.

day

Day of the month.

week

Week

weekday

Day of the week

yearday

Day of the year.

hour

Hour of the day.

minutes

Minutes

seconds

Seconds

tzoffsethours

The time zone offset. An offset of +1 means 1 hour to the east of GMT.

tzoffsetminutes

The additional offset in minutes (between 0 and 59).

Columns corresponding to elements that do not occur in any of the strings are omitted from the resulting data.frame.

Examples

iso8601todataframe(c("2014-W01-1", "2041-02-12T12+00", NA, "T22"))

iso8601todataframe(c("2014-W01-1", "2041-02-12T12+00", NA, "T22"),
  transformdate = "toyearmonthday")


[Package iso8601 version 0.1.2 Index]