Learn R Programming

itsadug (version 2.4.1)

start_event: Determine the starting point for each time series.

Description

Determine the starting point for each time series.

Usage

start_event(
  data,
  column = "Time",
  event = "Event",
  label = "start.event",
  label.event = NULL,
  order = TRUE,
  newcode = TRUE
)

Arguments

data

A data frame.

column

Test string, name of the column that describes the order withing the time series. Default is 'Time'.

event

A text string or vector indicating the columns that define the unique time series. Default is 'Event'.

label

The name of the new column with the start point of each time series. Default is 'start.event'.

label.event

In case event is not a single column, providing a text string will add a column with this name that defines unique time series. Default is NULL (no new column for time series is created).

order

Logical: whether or not to order each time series. Default is TRUE, maybe set to FALSE with large data frames that are already ordered.

newcode

Logical: whether or not to use the new (and hopefully faster) code.

Value

Data frame.

See Also

Other functions for model criticism: acf_n_plots(), acf_plot(), acf_resid(), derive_timeseries(), resid_gam(), start_value_rho()

Examples

Run this code
# NOT RUN {
data(simdat)
head(simdat)
simdat <- simdat[sample(1:nrow(simdat)),]
simdat$Condition <- relevel(factor(simdat$Condition), ref="0")
contrasts(simdat$Condition) <- "contr.poly"
contrasts(simdat$Condition)
test <- start_event(simdat, event=c('Subject', 'Trial'), label.event='Event') 
contrasts(test$Condition)
head(test)
test <- start_event(simdat, event="Subject")
test <- start_event(simdat, event=c('Subject', 'Trial'))
# }

Run the code above in your browser using DataLab