align_events | R Documentation |
Uses a vectory specifying whether data falls into an event to reshape data, aligning by the onset of the event
align_events(
df,
df_isevent,
dovars,
leng_threshold,
before,
after,
do_norm = FALSE,
nbins = 6,
normbin = 2
)
df |
A data frame containing all data continuously along time,
required columns: |
df_isevent |
A data frame |
dovars |
A vector of character strings specifying which columns
(by column name) of |
leng_threshold |
An integer specifying the minimum number of consecutive
dates required to define an event. All events of length lower than
|
before |
An integer specifying the number of days before the event onset to be retained in re-arranged data |
after |
An integer specifying the number of days after the event onset to be retained in re-arranged data |
do_norm |
A logical specifying whether re-arranged data is to be
normalised by the median value of the bin
(number of bins given by argument |
nbins |
An integer, specifying the number of bins used to determine median values before event onset. Only used when codedo_norm=TRUE. Defaults to 6. |
normbin |
An integer, specifying the bin number just before the event onset, used for normalisation. Only used when codedo_norm=TRUE. Defaults to 2. |
A named list of data frames (list( "df_dday", "df_dday_aggbydday")
)
containing data from all events and before + after
dates (relative
to event onset) with additional columns named "inst"
, defining the
event number (instance), and "dday"
, defining the date relative to the
respective event onset. The data frame "df_dday"
contains rearranged,
but otherwise unchanged data (unless do_norm
=TRUE). The data frame
"df_dday_aggbydday"
containes data aggregated across events with the
mean and quantiles given for each "dday"
.
df_alg <- align_events( df, truefalse, before=30, after=300 )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.