ds_tailobs: Tail Observations

Description Usage Arguments Details Value See Also Examples

View source: R/ds-describe.R

Description

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

Usage

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

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.

Value

n highest/lowest observations from data

See Also

top_n

Examples

1
2
3
4
5
6
7
8
# 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)

rsquaredacademy/descriptr documentation built on July 9, 2021, 8:13 p.m.