median.fdt: Median of frequency distribution table (numerical variable)

View source: R/median.fdt.R

median.fdtR Documentation

Median of frequency distribution table (numerical variable)

Description

S3 method for the median of a fdt.
Useful to estimate the median (when the real data vector is not known) from a previous fdt.

Usage

## S3 method: numerical 
## S3 method for class 'fdt'
median(x, ...)

Arguments

x

a fdt (simple or multiple) object.

...

required by generic.

Details

median.fdt calculates the value of the median based on a known formula. median.fdt.multiple calls mean.fdtfor each variable, that is, each column of the data.frame.

Value

mean.fdt returns a numeric vector containing the value of the median of the fdt. median.fdt.multiple returns a list, where each element is a numeric vector containing the value of the median of the fdt for each variable.

Author(s)

Faria, J. C.
Allaman, I. B
Jelihovschi, E. G.

See Also

mean.fdt, mfv.

Examples

mdf <- data.frame(x=rnorm(1e3, 
                          20, 
                          2),
                  y=rnorm(1e3, 
                          30,
                          3),
                  z=rnorm(1e3,
                          40,
                          4))

head(mdf)

# From a data.frame
apply(mdf,
      2,
      median)

# From a fdt object
median(fdt(mdf))

jcfaria/fdth documentation built on Nov. 24, 2023, 4:16 a.m.