Learn R Programming

Dasst (version 0.3.4)

addDate<-: Add date class to objects of class Dasst

Description

addDate<- adds a column of class date to tables of the object of class '>Dasst.

Arguments

x

An object of class '>Dasst.

...

Other parameters: format, character vector encoding the date format;

value

A formula, numeric vector or character vector. Order of the column fields from where dates can be composed.

Value

The actual object.

Details

This method adds a column of class date to tables of the object of class '>Dasst. Dates expressed as string or integers may be converted and stored as date objects in a new column whose name begins with "date_" and follows with the names of column fields involved in the date extraction.

So far, the new column will not be saved if the write method is invoked.

Examples

Run this code
# NOT RUN {
data(plantGrowth)
addDate(plantGrowth) <- ~ YEAR + DOY

# or
addDate(plantGrowth) <- c("YEAR", "DOY")

# or
addDate(plantGrowth) <- c(1, 2)

# Only one tables 1 and specifying date format
addDate(plantGrowth, index=c(1,2), format="%Y%j") <- ~ YEAR + DOY
# }

Run the code above in your browser using DataLab