frequencies | R Documentation |
This function generates a quick frequencies or proportions table. Useful for freqbubble function
frequencies(df, group = NULL, missing = TRUE, prop = FALSE,
round1 = 2, bubbleSize= c(2, 30))
df |
vector, dataframe or matrix |
group |
A vector same length as df (e.g, df$group) Default (NULL) |
missing |
Logical. TRUE (default) missing displayed |
prop |
Logical. If TRUE proportions are displayed instead of frequencies |
round1 |
Rounds values. default=2 |
bubbleSize |
bubble size range, default = c(2, 30) |
Matrix table
Ariadna Angulo-Brunet (ariadna.angulo@uab.cat), Carme Viladrich
table
#generate some random data
x<-1:5
y<-1:2
v1<-sample(x,80,replace=TRUE)
v2<-sample(x,80,replace=TRUE)
v3<-sample(x,80,replace=TRUE)
v4<-sample(x,80,replace=TRUE)
gender<- sample(y, 80, replace=TRUE)
df <- data.frame(v1, v2,v3,v4)
#Execute default function (frequencies with missing data included)
frequencies(df)
#Execute proportions without missings
frequencies(df, missing=FALSE, prop=TRUE)
#Execute frequencies by group
frequencies(df, group=gender)
#Execute proportions by group
frequencies(df, group=gender, prop=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.