Learn R Programming

wrMisc (version 1.15.3.1)

top3mean: Mean Of 3 Highest Values

Description

This function returns the mean of the top3 highest values.

Usage

top3mean(x, silent = FALSE, debug = FALSE, callFrom = NULL)

Value

This function returns a vector with single numeric value for mean of top3 ( returns NULL with invalid input or if all input is NA)

Arguments

x

(numeric vector) main input

silent

(logical) suppress messages

debug

(logical) additional messages for debugging

callFrom

(character) allows easier tracking of messages produced

Details

Generally, NA will be excluded, if all values are NA this finction will return NULL ; thus, in case of (entirely) unsuitable data (non-numeric ...) NULL will be returned. If data has subgroups you may try a tapply -way.

See Also

Examples

Run this code
x1 <- c(15:11,NA,16)
top3mean(x1)

Run the code above in your browser using DataLab