plsubset: Subsetting a Data.Frame with pl Attributes

plsubsetR Documentation

Subsetting a Data.Frame with pl Attributes

Description

Select rows of data.frames keeping the variable attributes that drive pl graphics

Usage

plsubset(x, subset = NULL, omit = NULL, select = NULL, drop = FALSE,
         keeprange = FALSE)

Arguments

x

data.frame from which the subset is to be generated

subset, omit

logical vector or vector of indices of rows or or rownames of x. If subset is used, omit is ignored.

select

vector of indices or names of variables to be selected

drop

logical: if only one variable remains, should the data.frame be converted into a vector?

keeprange

logical: should ranges (inner.range and plrange) be maintained?

Details

plsubset maintains the 'pl' attributes of the variables of the data.frame (if there are), such as 'col', 'lty', ..., and subsets the two attributes 'numvalues' and 'plcoord'. This is useful if the way of displaying the axis is to be kept when a new plot is drawn.

Value

Data.frame with the selected rows (or without the omitted rows, respectively) and all attributes as described above.

Author(s)

Werner A. Stahel

See Also

Argument subset of the high level 'pl' functions plyx, plmatrix

Examples

data(d.river)
dd <- d.river[seq(1,1000,4),]
dd$date <- gendateaxis("date",hour="hour", data=dd)
attr(dd$date, "ticksat")

dsubs <- plsubset(dd, subset=1:50)
attr(dsubs$date, "ticksat")

plyx(O2~date, data=dsubs)
## same as
## plyx(O2~date, data=dd, subset=1:50)

plgraphics documentation built on Oct. 19, 2023, 3 p.m.