Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

mean.fdt

Mean of frequency distribution table (numerical variable)


Description

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

Usage

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

Arguments

x

A fdt (simple or multiple) object.

...

Required by generic.

Details

mean.fdt calculates the mean value based on a known formula using the midpoint of each interval class. mean.fdt.multiple calls mean.fdt for each variable, that is, each column of the data.frame.

Value

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

Author(s)

José Cláudio Faria
Enio G. Jelihovschi
Ivan B. Allaman

See Also

median.fdt, mfv.

Examples

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

head(mdf)

apply(mdf,
      2,
      mean)

mean(fdt(mdf))

fdth

Frequency Distribution Tables, Histograms and Polygons

v1.2-5
GPL (>= 2)
Authors
Jos<e9> Cl<e1>udio Faria, Enio G. Jelihovschi and Ivan B. Allaman
Initial release
2020-04-17

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.