Most frequent value (statistical mode) of frequency distribution table (numerical and categorical variable)
S3 methods for the most frequent value (statistical mode) of a fdt.
Useful to estimate the most frequent value or statistical mode. May also be used, by using a previous fdt, when the original data vector is not known.
## S3 generic mfv(x, ...) ## S3 methods: numerical and categorical ## Default S3 method: mfv(x, ...) ## S3 method for class 'fdt' mfv(x, ...) ## S3 method for class 'fdt.multiple' mfv(x, ...) ## S3 method for class 'fdt_cat' mfv(x, ...) ## S3 method for class 'fdt_cat.multiple' mfv(x, ...)
x |
A |
... |
Required to be generic. |
mfv.fdt and mfv.fdt_cat calculates the most frequent value (mfv) based on a known formula.
mfv.fdt.multiple and mfv.fdt_cat.multiplecall respectively mfv.fdt
or mfv.fdt_catfor each variable, that is, each column of the data.frame.
mfv.fdt returns a numeric vector containing the mfv 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.
mfv.fdt_cat returns a character vector containing the mfv value of the fdt_cat.
mean.fdt_cat.multiple returns a list, where each element is a character vector
containing the mfv value of the fdt_cat for each variable.
José Cláudio Faria
Enio G. Jelihovschi
Ivan B. Allaman
mean.fdt, median.fdt.
## Numerical
mdf <- data.frame(x=rnorm(1e2,
20,
2),
y=rnorm(1e2,
30,
3),
z=rnorm(1e2,
40,
4))
head(mdf)
mfv(mdf$x) # From vector x
mfv(mdf$y) # From vector y
mfv(mdf$z) # From vector z
(tb <- fdt(mdf))
mfv(tb) # From agruped dad in a fdt
## Categorical
mdf <- data.frame(c1=sample(letters[1:5],
1e3,
rep=TRUE),
c2=sample(letters[6:10],
1e3,
rep=TRUE),
c3=sample(letters[11:21],
1e3,
rep=TRUE),
stringsAsFactors=TRUE)
head(mdf)
mfv(mdf$c1) # From vector c1
mfv(mdf$c2) # From vector c2
mfv(mdf$c3) # From vector c3
(tb <- fdt_cat(mdf))
mfv(tb) # From agruped dad in a fdtPlease choose more modern alternatives, such as Google Chrome or Mozilla Firefox.