Coerce a data frame into a bts object, using a suitable column as a date.

# S3 method for data.frame
as.bts(object, dateName, yearName, ...)

Arguments

object

A data frame with one column

dateName

Character. Optional column name for a date in an understandable format.

yearName

Character. Optional column name for a year. When given, the column must be either numeric or character.

...

Not used.

Value

An object with class "bts" inheriting from "matrix".

Examples

## does not work
bts0 <- try(as.bts(TXMax_Dijon))
#> Error in as.bts.data.frame(TXMax_Dijon) : 
#>   'dateName' an 'yearName' can both be missing only if 'object' contains exactly one column with class "Date"
## works
bts1 <- try(as.bts(TXMax_Dijon, year = "Year"))