Description Usage Arguments Details Value Author(s) See Also Examples
A vector based summary function. Provides a table with percentages for discrete data. And median, mean, range or standard deviation for continuous data.
1 | get.summary(var,type, var.n=NULL, type2="range")
|
var |
A vector, can be discrete(integer, character or factor) or continuous(numeric) |
type |
integer |
type=1
if x
is continuous
type=2
if x
is discrete
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 ";"
Arshi Arora
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | #when type=1, data is discrete
set.seed(123)
x<-sample(1:3,50, replace=TRUE)
get.summary(x,type=1)
#lets see with NAs
x[c(1,5,30)] = NA
get.summary(x,type=1)
#when type=2, data is continuous
set.seed(123)
x<-rnorm(50)
get.summary(x, type=2, type2="range")
x[c(1,5,30)] = NA
get.summary(x, type=2, type2="sd")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.