Learn R Programming

descriptr (version 0.6.1)

ds_tailobs: Tail Observations

Description

Returns the n highest/lowest observations from a numeric vector.

Usage

ds_tailobs(data, n, type = c("low", "high"), decimals = 2)

Value

n highest/lowest observations from data

Arguments

data

a numeric vector

n

number of observations to be returned

type

if low, the n lowest observations are returned, else the highest n observations are returned.

decimals

An option to specify the exact number of decimal places to use. The default number of decimal places is 2.

Details

Any NA values are stripped from data before computation takes place.

See Also

Examples

Run this code
# 5 lowest observations
ds_tailobs(mtcarz$mpg, 5)

# 5 highest observations
ds_tailobs(mtcarz$mpg, 5, type = "high")

# specify decimal places to display
ds_tailobs(mtcarz$mpg, 5, decimals = 3)

Run the code above in your browser using DataLab