Last data update: 2014.03.03

R: Frequencies
FrequenciesR Documentation

Frequencies

Description

This function calculate to return answer which are descriptive statistics values for a discrete variable or discrete variables in data frame.

Usage

Frequencies(x, plot = FALSE, r = 2, answer = 1)

Arguments

x

A discrete variable or a data frame contain discrete variable.

plot

Let plot=TRUE to paint pie graph.

r

Rounds the answer to the specified number of decimal places (default 2).

answer

Form of answers are returned. Let answer=1 or answer=2 (default 1)

Details

Statistic descriptive values are calculated by theory of base statistic.

Value

N

Length sample

NaN

Number NA values

(xi)N

Length of xi

VAR

Variance value

SD

Standard Deviation

SE

Standard Deviation of the Estimated Means

Note

You must not withdraw continuously variables from data frame. When you let a data frame in to this function which will auto withdraw continuously variables and calculate descriptive statistic to discrete variables.

Author(s)

Hong Viet Minh <hongvietminh@gmail.com>

References

Theory of base statistic.

See Also

Descriptives, Dgroup

Examples

#Load data
library(MASS)
data(crabs)

#Descriptive for a discrete variable
Frequencies(crabs$sp,plot=TRUE)

#Descriptive for discrete variables
Frequencies(crabs,answer=2,plot=TRUE)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(AnalyzeTS)
Loading required package: MASS
Loading required package: TSA
Loading required package: leaps
Loading required package: locfit
locfit 1.5-9.1 	 2013-03-22
Loading required package: mgcv
Loading required package: nlme
This is mgcv 1.8-12. For overview type 'help("mgcv-package")'.
Loading required package: tseries

Attaching package: 'TSA'

The following objects are masked from 'package:stats':

    acf, arima

The following object is masked from 'package:utils':

    tar

Loading required package: TTR
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/AnalyzeTS/Frequencies.Rd_%03d_medium.png", width=480, height=480)
> ### Name: Frequencies
> ### Title: Frequencies
> ### Aliases: Frequencies
> ### Keywords: Frequencies
> 
> ### ** Examples
> 
> #Load data
> library(MASS)
> data(crabs)
> 
> #Descriptive for a discrete variable
> Frequencies(crabs$sp,plot=TRUE)
          x
N:   200.00
NaN:   0.00
BN:  100.00
ON:  100.00
VAR:   0.25
SD:    0.50
SE:    0.04
Warning messages:
1: In var(x) :
  Calling var(x) on a factor x is deprecated and will become an error.
  Use something like 'all(duplicated(x)[-1L])' to test for a constant vector.
2: In var(if (is.vector(x) || is.factor(x)) x else as.double(x), na.rm = na.rm) :
  Calling var(x) on a factor x is deprecated and will become an error.
  Use something like 'all(duplicated(x)[-1L])' to test for a constant vector.
3: In var(if (is.vector(x) || is.factor(x)) x else as.double(x), na.rm = na.rm) :
  Calling var(x) on a factor x is deprecated and will become an error.
  Use something like 'all(duplicated(x)[-1L])' to test for a constant vector.
> 
> #Descriptive for discrete variables
> Frequencies(crabs,answer=2,plot=TRUE)
[[1]]
    N: NaN: BN: ON: VAR: SD:  SE:
sp 200    0 100 100 0.25 0.5 0.04

[[2]]
     N: NaN: FN: MN: VAR: SD:  SE:
sex 200    0 100 100 0.25 0.5 0.04

Warning messages:
1: In var(x) :
  Calling var(x) on a factor x is deprecated and will become an error.
  Use something like 'all(duplicated(x)[-1L])' to test for a constant vector.
2: In var(if (is.vector(x) || is.factor(x)) x else as.double(x), na.rm = na.rm) :
  Calling var(x) on a factor x is deprecated and will become an error.
  Use something like 'all(duplicated(x)[-1L])' to test for a constant vector.
3: In var(if (is.vector(x) || is.factor(x)) x else as.double(x), na.rm = na.rm) :
  Calling var(x) on a factor x is deprecated and will become an error.
  Use something like 'all(duplicated(x)[-1L])' to test for a constant vector.
4: In var(x) :
  Calling var(x) on a factor x is deprecated and will become an error.
  Use something like 'all(duplicated(x)[-1L])' to test for a constant vector.
5: In var(if (is.vector(x) || is.factor(x)) x else as.double(x), na.rm = na.rm) :
  Calling var(x) on a factor x is deprecated and will become an error.
  Use something like 'all(duplicated(x)[-1L])' to test for a constant vector.
6: In var(if (is.vector(x) || is.factor(x)) x else as.double(x), na.rm = na.rm) :
  Calling var(x) on a factor x is deprecated and will become an error.
  Use something like 'all(duplicated(x)[-1L])' to test for a constant vector.
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>