Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

truncate_phase

Truncate single-case data


Description

This function truncates data points at the beginning and / or end each phase.

Usage

truncate_phase(
  data,
  dvar,
  pvar,
  truncate = list(A = c(0, 0), B = c(0, 0)),
  na = TRUE
)

truncateSC(...)

Arguments

data

A single-case data frame. See scdf to learn about this format.

dvar

Character string with the name of the dependent variable. Defaults to the attributes in the scdf file.

pvar

Character string with the name of the phase variable. Defaults to the attributes in the scdf file.

truncate

A list with a vector of two (beginning and end) values for each phase defining the number of data points to be deleted. For lists of single-case data frames, the truncation is adapted to the length of each phase for each single case.

na

If FALSE, the truncated measurement times are deletet. If TRUE, NAs are set for the dependent variable.

...

Further arguments passed to the function.

Value

A truncated data frame (for each single-case).

Author(s)

Juergen Wilbert

See Also

Other data manipulation functions: fill_missing(), longSCDF(), outlier(), ranks(), shift(), smooth_cases(), standardize()

Examples

# Truncate the first two data points of both phases and compare the two data sets
study <- c(
  "Original" = byHeart2011[1],
  "Selected" = truncate_phase(byHeart2011[1], truncate = list(A = c(2, 0), B = c(2, 0)))
)
plot(study)

scan

Single-Case Data Analyses for Single and Multiple Baseline Designs

v0.51
GPL
Authors
Juergen Wilbert [aut, cre], Timo Lueke [aut]
Initial release
2021-2-11

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.