Remove padded rows from matrix X

Share:

Description

Remove padded rows from matrix X

Usage

1
eTrim(X, pad = NA)

Arguments

X

R object coercible to matrix

pad

Value representing padded elements. By default it is NA, but could be any value.

Value

A matrix.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
n <- 10
x <- rnorm(n)    # x vector
X <- eLag(x,0:1) # X matrix
t <- 1:n         # time vector
T <- eLag(t,0:1) # time matrix; the column corresponding
                 # to 0 is the time for each row,
                 # even after trimming
matplot(X,type="l",lty=1)
X <- eTrim(X)
T <- eTrim(T)
matplot(x=T[,1],y=X,type="l",lty=1,
  xlab="Time")