clip_data: remove extreme values from a vector

Description Usage Arguments Details Value Methods (by class) Author(s)

View source: R/fun-clip_data.R

Description

Remove the smallest and greatest values from a vector of from a column of a data frame.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
clip_data(x, clip = 1L, ...)

## Default S3 method:
clip_data(x, clip = 1L, preserve.order = TRUE, ...)

## S3 method for class 'factor'
clip_data(x, clip = 1L, preserve.order = TRUE, ...)

## S3 method for class 'numeric'
clip_data(x, clip = 1L, preserve.order = TRUE, ...)

## S3 method for class 'data.frame'
clip_data(x, clip = 1L, column, ...)

Arguments

x

a vector or a data frame

clip

either number(s) or fraction(s) (rounding up) of values to be removed, see Details

...

arguments passed to other methods

preserve.order

logical flag whether result should be returned sorted or in the original order (default)

column

for data.frame method, name of column to clip

Details

The clip arguments determines the number of items/observations removed:

After clipping a t test is run to determine whether the clipping significantly changed the mean of the vector. In case of a data frame this is also done for every other numeric variable. The result of the test is reported as a warning if positive (p < 0.05) and as a message if negative.

Value

A clipped vector or data frame.

Methods (by class)

Author(s)

Aleksander Chlebowski, June 2018


olobiolo/acutils documentation built on Nov. 28, 2021, 9:35 p.m.