prep_yrs: Internal Function: Check years range & sort

Description Usage Arguments See Also Examples

Description

Intended to be called from make_history. Prints a warning any of the specified years aren't included in the dataset and returns a vector of availabe years, sorted ascending. The sort ensures correct ordering in subsequent license history calculations, which include iterations by year that would produce incorrect results if not sorted.

Usage

1
prep_yrs(yrs, df, func_name)

Arguments

yrs

numeric: Years in sales data (column 'year') from which to create license history

df

data frame: table that contains "year" variable

func_name

character: name of function to print in warning

See Also

Other internal license history functions: history_internal

Examples

1
2
3
data(sale)
prep_yrs(c(2010, 2008, 2015), sale, "my_function")
prep_yrs(c(2007, 2015, 2010), sale, "my_function") # print a warning

southwick-associates/salic documentation built on Nov. 5, 2019, 9:13 a.m.