completeLowResolutionData: Duplicates data with low time resolution to match high...

Description Usage Arguments Value Examples

View source: R/data_handling.R

Description

Let data in low resolution be given (e.g. monthly, quarterly). This is then matched to a high resolution (e.g. daily) and the corresponding entries are copied.

Usage

1
completeLowResolutionData(date_target, df, by_column = "Date")

Arguments

date_target

Time series of desired output (high resolution).

df

Data frame with the low resolution data.

by_column

String which identifies the date column in df. As a default, it uses "Date".

Value

Returns data frame with copied entries. The response is sorted in chronological order.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
ts <- data.frame(Date = seq(from = as.Date("2000-01-01"), to = as.Date("2000-03-31"), by = "1 day"))

df_monthly <- data.frame(Month = c(as.Date("2000-01-31"),
                                   as.Date("2000-02-29"),
                                   as.Date("2000-03-31")),
                         Values = 1:3)
df_daily <- completeLowResolutionData(ts$Date, df_monthly, "Month")

# example of how to bind things together
library(dplyr)
ts <- ts %>%
  left_join(df_daily, by = c("Date" = "Month"))

sfeuerriegel/ResearchGroupTools documentation built on May 29, 2019, 8:01 p.m.