clean_times: Convert Statfin time variable(s) to numeric or date

View source: R/times.R

clean_timesR Documentation

Convert Statfin time variable(s) to numeric or date

Description

Convert Statfin time variable(s) to numeric or date

Usage

clean_times(
  x,
  time_format = NULL,
  year_col = "Vuosi",
  sub_year_col = NULL,
  agg_time = NULL
)

Arguments

x

A data.frame.

time_format

"num" for numeric (default for yearly) and "date" for Date (default otherwise)

year_col

A column name for year

sub_year_col

A column name for quarter or mounth. If NULL (default) tries to guess.

agg_time

sub_year_col might contain also aggregate values, like yearly sums. They are exluded based on order of factor level or occurence in data. Default is that nothing is exluded.

Value

A data.frame

Examples

public_debt2 <- clean_times(public_debt)
str(public_debt2)
str(clean_times(output_ind, time_format = "date"))
employment_q2 <- clean_times(x = employment_q, sub_year_col = "Ajanjakso", agg_time = "Vuosikeskiarvo")

pttry/statfitools documentation built on Feb. 2, 2025, 1:50 a.m.