Description Usage Arguments Value Author(s) Examples

Compute the frequency table of a categorical or a numerical series.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |

`data` |
a tibble, |

`x` |
a categorical or numerical series, |

`f` |
a string containing |

`vals` |
a character containing letters indicating the values of
the variable that should be returned; |

`weights` |
a series that contain the weights that enable the sample to mimic the population, |

`total` |
a logical indicating whether the total should be returned, |

`max` |
if the series is a discrete numerical value, this
argument indicates that all the values greater than |

`breaks` |
a numerical vector of class limits, |

`right` |
a logical indicating whether classes should be closed
( |

`xfirst, xlast, wlast` |
see |

`freq` |
a series that contains the frequencies (only relevant
if |

`mass` |
a series that contains the masses of the variable (only
relevant if |

`center` |
a series that contains the center of the class of the
variable (only relevant if |

a tibble containing the specified values of `vals`

and
`f`

.

Yves Croissant

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | ```
# in table padova, price is a numeric variable, a vector of breaks should be provided
library("dplyr")
padova %>% freq_table(price,
breaks = c(50, 100, 150, 200, 250, 300, 350, 400),
right = TRUE)
# return relative frequencies and densities, and the center value
# of the series and the width of the bin
padova %>% freq_table(price,
breaks = c(50, 100, 150, 200, 250, 300, 350, 400),
right = TRUE, f = "fd", vals = "xa")
# in table wages, wage is a factor that represents the classes
wages %>% freq_table(wage, "d")
# a breaks argument is provided to reduce the number of classes
wages %>% freq_table(wage, breaks = c(10, 20, 30, 40, 50))
# a total argument add a total to the frequency table
wages %>% freq_table(wage, breaks = c(10, 20, 30, 40, 50), total = TRUE)
# ìncome is already a frequency table, the freq argument
# is mandatory
income %>% freq_table(inc_class, freq = number)
# the mass argument can be indicated if on column contains the
# mass of the series in each bin. In this case, the center of the
# class are exactly the mean of the series in each bin
income %>% freq_table(inc_class, freq = number, mass = tot_inc)
# rgp contains a children series which indicates the number of
# children of the households
rgp %>% freq_table(children)
# a max argument can be indicated to merge the unusual high
# values of number of childre
rgp %>% freq_table(children, max = 4)
# employment is a non random survey, there is a weights series
# that can be used to compute the frequency table according to the
# sum of weights and not to counts
employment %>% freq_table(education)
employment %>% freq_table(education, weights = weights)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.