Learn R Programming

tsibble (version 0.6.1)

split_by: Deprecated functions

Description

A thin wrapper of dplyr::case_when() if there are NAs

Find which row has duplicated key and index elements

Usage

split_by(x, ...)

case_na(formula)

as.tsibble(x, ...)

fill_na(.data, ..., .full = FALSE)

find_duplicates(data, key = id(), index, fromLast = FALSE)

Arguments

x

A data frame.

...

A list of unquoted variables, separated by commas, to split a dataset.

formula

A two-sided formula. The LHS expects a vector containing NA, and the RHS gives the replacement value.

data

A tbl_ts object.

key

Structural variable(s) that define unique time indices, used with the helper id. If a univariate time series (without an explicit key), simply call id().

index

A bare (or unquoted) variable to specify the time index variable.

fromLast

TRUE does the duplication check from the last of identical elements.

Value

A logical vector of the same length as the row number of data

See Also

dplyr::case_when

Examples

Run this code
# NOT RUN {
pedestrian %>% 
  split_by(Sensor)
x <- rnorm(10)
x[c(3, 7)] <- NA_real_
case_na(x ~ 10)
case_na(x ~ mean(x, na.rm = TRUE))
# }

Run the code above in your browser using DataLab