View source: R/StoxBaselineFunctions.R
DefinePeriod | R Documentation |
Define periods, temporal categories such as 'Quarter', 'Month' or some custom defintion.
DefinePeriod(
processData,
TemporalCategory = c("Quarter", "Month", "Custom"),
CustomPeriods = character(),
UseProcessData = F
)
processData |
|
TemporalCategory |
type of temporal category: 'Quarter', 'Month' or 'Custom', defaults to 'Quarter' |
CustomPeriods |
provide if temporalCategory is 'Custom', vector of strings formatted as DD-MM or DD-MM-YYYY, giving the start date of each temporal category. See 'details' |
UseProcessData |
If TRUE, bypasses execution of function and returns existing 'processData' |
Periods define an association between dates and a categorical variable definition, such as 'Month', 'Quarter' or some custom definition.
Periods may be seasonal, which means that dates are associated with the categories based on day and month only. This distinction does not matter if all data is from the same year. The 'TemporalCategory'-options 'Quarter' and 'Month' produce seasonal definitions, so that Jan 1st 2015 and Jan 1st 2016 belon to the same category (e.g. "Q1" if 'TemporalCategory' is 'Quarter').
In order to make custom seasonal definitions, use the TemporalCategory'-option 'Custom' without providing years in 'CustomPeriods': "DD-MM". Periods defined in this way will automatically "wrap around" so that dates in January may grouped together with dates in December.
In order to make non-seasonal definitions for Quarter or Month, provide the 'CustomPeriods' for all years of interest on the format "DD-MM-YYYY". If years are provided the periods do not "wrap around" and categories are automatically extended to the entire year, if necesesarry. That is a category starting with 1. Jan is added if not present, and likewise a category ending with 31. Dec.
Temporal Categories, see: TemporalDefinition
.
AddPeriodStoxBiotic
and AddPeriodStoxLanding
for adding Periods to data.
# Define seasonal periods quarter
DefinePeriod(TemporalCategory = "Quarter")
# Define two periods "15th March - 15th Sep" and "15th Sep - 15th March"
DefinePeriod(TemporalCategory = "Custom", CustomPeriods = c("15-09", "15-03"))
# Add years to speficiation to define four periods "15th March 2015 - 31st Dec 2015" ...
DefinePeriod(TemporalCategory = "Custom", CustomPeriods = c("15-09-2105", "15-03-2015"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.