freq | R Documentation |
Intervalo de confianza para proporciones Hacerlo para medias tb
freq( df, ..., group_by_col = NULL, col_names = c("Variable", "Values", "n", "rel.freq", "rel.valid.freq"), col_names_groups = c("grouping.by", "groups", "rel.group.freq"), decimals = 2, show_warnings = TRUE, total = TRUE, total_by_group = TRUE, sort_by_values = FALSE, sort_by_freq = FALSE, sort_by_percent = FALSE, sort_decreasing = TRUE, debug = FALSE )
df |
data |
... |
variables (no quotes needed) |
group_by_col |
column used to group the other variables |
col_names |
vector with names for the 4 columns |
col_names_groups |
vector with the names of the 2 columns regarding grouping |
decimals |
number of decimals to show |
show_warnings |
if you want to print any warning that may come up |
total |
total values of frequencies and percentajes without groups |
total_by_group |
total values of frequencies and percentajes within each group |
sort_by_values |
sort results by variable categories |
sort_by_freq |
sort results by frequency |
sort_by_percent |
sort results by perecentage |
sort_decreasing |
make the sorting descending |
debug |
show debug information |
==========================================
Confidence Interval = p +/- z*(√p(1-p) / n)
where:
p: sample proportion z: the chosen z-value n: sample size
Title freq
The freq function creates a dataframe with the frequencies of the independent values in one or more variables passed as arguments. It can also give the information grouping said variable/s by a different one
list of dataframes (1 per variable)
## Not run: data_ <- data.frame(AGE=sample(x = 65:100, size=30, replace = TRUE ), HEIGHT=sample(x = 120:205, size=30, replace = TRUE ), SEX=sample(x = c("Male", "Female"), prob = c(.5,.5), size = 30, replace = TRUE), BLOND=sample(x = c("Yes", "No"), prob = c(.2,.8), size = 30, replace = TRUE) ) data_ <- rbind(data_, list(NA,NA,NA,NA)) data_ <- rbind(data_, list(NA,NA,"Male",NA)) data_ <- rbind(data_, list(NA,NA,NA,"No")) # -- regular freq freq(data_, SEX) # -- freq sorted by Value freq(data_,SEX, sort_by_values = TRUE, sort_decreasing = FALSE) # -- multiple variables freq(data_, SEX, BLOND) # -- one variable grouped by another freq(data_, SEX, group_by_col = BLOND) # -- one variable grouped by another, without groups totals freq(data_, SEX, group_by_col = BLOND, total_by_group = FALSE) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.