get.summary.Rd
A vector based summary function. Provides a table with percentages for discrete data. And median, mean, range or standard deviation for continuous data.
get.summary(var,type, var.n=NULL, type2="range")
var | A vector, can be discrete(integer, character or factor) or continuous(numeric) |
---|---|
type | integer |
type2 | if |
var.n | character. specify the name of the variable that you are summarizing. Default is |
Summary statistics are rounded to nearest 2 decimal points.
if type=1
returns a character vector with summary information. length of the vector is equal to length of unique classes and NA
if any.
if type=2
returns a character of length 1 with summary information. NAs
are separated by ";"
get.summary2
#> [,1] #> =1 "16(32%)" #> 2 "15(30%)" #> 3 "19(38%)"#> [,1] #> =1 "16(32%)" #> 2 "14(28%)" #> 3 "17(34%)" #> <NA> "3(6%)"#> [,1] #> [1,] "-0.07(-1.97,2.17); NA=0"#> [,1] #> [1,] "-0.08(0.93); NA=3"