inner.data.frame: Limit Data to Inner Quantiles by Imputing NA.

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

inner is generic. inner.data.frame imputes NA for cells within columns that represent extreme quantiles. By default, the ‘inner’ 95 percent of each column is preserved.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## S3 method for class 'data.frame'
inner(
	x,
	prob=0.95,
	tail=0.5*(1-prob),
	lo=tail,
	hi=prob+tail,
	include.lowest=TRUE,
	include.highest=TRUE,
	preserve=character(0),
	id.var=character(0),
	measure.var=setdiff(names(x),c(preserve,id.var)),
	na.rm=FALSE,
	...
)

Arguments

x

data.frame

prob

the fraction of data to preserve

tail

the fraction of data to ignore at each extreme

lo

the probability below which data will be ignored

hi

the probability above which data will be ignored

include.lowest

whether to preserve values at probability equal to lo

include.highest

whether to preserve values at probability equal to hi

preserve

vector of names for columns to preserve but ignore

id.var

vector of names for columns that indicate data subsets

measure.var

vector of names for columns to limit

na.rm

passed to quantile

...

passed to fun.aggregate

Details

prob and tail are not actually used internally, but serve only to calculate symmetric defaults for lo and hi. If the latter are supplied, the former are ignored. Tails need not be symmetric.

By default, all columns are classified as measure.var: an attempt will be made to limit such. Columns classified as preserve will simply be passed through to the result. Columns classified as id.var specify row subsets that are limited independently of eachother. See examples.

Value

a data frame with the same rows, columns, row order, and column order as x (except for dropped columns)

Author(s)

Tim Bergsma

References

http://metrumrg.googlecode.com

See Also

Examples

1
2
3
4
5
6
7
x <- airquality[c(1:10,32:41),]
x
inner(x,id.var=c('Month','Day'),na.rm=TRUE)#identity
inner(x,id.var='Month',preserve='Day',na.rm=TRUE)#quantiles within Month
inner(x,preserve=c('Month','Day'),na.rm=TRUE)#quantiles across all rows
inner(x,measure.var=c('Ozone','Solar.R','Wind','Temp'),na.rm=TRUE)# dropping Month, Day
inner(rock,prob=0.5)

metrumrg documentation built on May 2, 2019, 5:55 p.m.