Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

as.caldays

Convert Stata business calendar dates in readable dates.


Description

Convert Stata business calendar dates in readable dates.

Usage

as.caldays(buisdays, cal, format = "%Y-%m-%d")

Arguments

buisdays

numeric Vector of business dates

cal

data.frame Conversion table for business calendar dates

format

character String with date format as in as.Date

Value

Returns a vector of readable dates.

Author(s)

Jan Marvin Garbuszus jan.garbuszus@ruhr-uni-bochum.de

Examples

# read business calendar and data
sp500 <- stbcal(system.file("extdata/sp500.stbcal", package="readstata13"))
dat <- read.dta13(system.file("extdata/statacar.dta", package="readstata13"))

# convert dates and check
dat$ldatescal2 <- as.caldays(dat$ldate, sp500)
all(dat$ldatescal2==dat$ldatescal)

readstata13

Import 'Stata' Data Files

v0.10.0
GPL-2 | file LICENSE
Authors
Jan Marvin Garbuszus [aut], Sebastian Jeworutzki [aut, cre] (<https://orcid.org/0000-0002-2671-5253>), R Core Team [cph], Magnus Thor Torfason [ctb], Luke M. Olson [ctb], Giovanni Righi [ctb], Kevin Jin [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.