Short demo on how to produce dynamic content in a shiny app at Rapporteket

makeHist(df, var, bins, makeTable = FALSE)

Arguments

df

dataframe from which output is to be made

var

string defining which varable in the data frame to use

bins

numeric vector defining the number of equally large groups

makeTable

Logical that if TRUE function will return a data frame containin the bin borders and count within each bin

Value

a graphical object or data frame

Examples

makeHist(df = mtcars, var = "mpg", bins = 5, makeTable = FALSE)

#> $breaks
#> [1] 10.4 15.1 19.8 24.5 29.2 33.9
#> 
#> $counts
#> [1]  6 12  8  2  4
#> 
#> $density
#> [1] 0.03989362 0.07978723 0.05319149 0.01329787 0.02659574
#> 
#> $mids
#> [1] 12.75 17.45 22.15 26.85 31.55
#> 
#> $xname
#> [1] "x"
#> 
#> $equidist
#> [1] TRUE
#> 
#> attr(,"class")
#> [1] "histogram"