Learn R Programming

dlm (version 1.1-6)

dropFirst: Drop the first element of a vector or matrix

Description

A utility function, dropFirst drops the first element of a vector or matrix, retaining the correct time series attributes, in case the argument is a time series object.

Usage

dropFirst(x)

Value

The function returns x[-1] or x[-1,], if the argument is a matrix. For an argument of class ts the class is preserved, together with the correct tsp attribute.

Arguments

x

a vector or matrix.

Author

Giovanni Petris GPetris@uark.edu

Examples

Run this code
(pres <- dropFirst(presidents))
start(presidents)
start(pres)

Run the code above in your browser using DataLab