Learn R Programming

MazamaTimeSeries (version 0.3.0)

mts_trim: Trim mts time series by removing missing values

Description

Trims the time range of an mts object by removing time steps from the start and end that contain only missing values.

Usage

mts_trim(mts = NULL)

Value

A subset of the incoming mts time series object. (A list with meta and data dataframes.)

Arguments

mts

mts object.

Examples

Run this code
library(MazamaTimeSeries)

# Untrimmed range
range(example_mts$data$datetime)

# Replace the first 50 data values for all non-"datetime" columns
example_mts$data[1:50, -1] <- NA

# Trimmed range
mts_trimmed <- mts_trim(example_mts)
range(mts_trimmed$data$datetime)

Run the code above in your browser using DataLab