Learn R Programming

DescriptiveStats.OBeu (version 1.3.2)

ds.analysis: Calculation of some Descriptive Tasks

Description

The function calculates the basic descriptive measures, the correlation and the boxplot parameters of all the numerical variables and the frequencies of all the nominal variables.

Usage

ds.analysis(data, c.out = 1.5, box.width = 0.15, outliers = TRUE, hist.class = "Sturges", 
corr.method = "pearson", fr.select = NULL, tojson = FALSE)

Arguments

data

The input data

c.out

Determines the length of the "whiskers" plot. If it is equal to zero no outliers will be returned.

box.width

The width level is determined 0.15 times the square root of the size of the input data.

outliers

If TRUE the outliers will be computed at the selected "c.out" level (default is 1.5 times the Interquartile Range).

hist.class

The method or the number of classes for the histogram.

corr.method

The correlation coefficient method to compute: "pearson" (default), "kendall" or "spearman".

fr.select

One or more nominal variables to calculate their corresponding frequencies.

tojson

If TRUE the results are returned in json format

Value

A list or json file with the following components:

  • descriptives The descriptive measures

  • boxplot The statistics of the boxplot

  • histogram The histogram parameters

  • frequencies The frequencies and the relative frequencies of factors/characters of the input dataset

  • correlation The correlation coefficient

Details

This function returns a list with the basic statistics, the parameters needed to visualize a boxplot and a histogram, it also provides the frequencies of non numerical data of the input dataset and the correlation coefficient. The input of this function can be a matrix or data frame.

See Also

open_spending.ds

Examples

Run this code
# NOT RUN {
# iris data frame as input with the default parameters
ds.analysis(iris)

# using iris data frame with different parameters
ds.analysis(iris, c.out = 1, box.width = 0.20, outliers = TRUE, tojson = TRUE)

# using iris data frame with different parameters 
# fr.select parameter specified as Species
ds.analysis(iris, c.out = 1, outliers = FALSE, fr.select = "Species", tojson = TRUE)

# OpenBudgets.eu Dataset Example:
ds.analysis(Wuppertal_df, c.out = 2, box.width = 0.15, 
outliers = FALSE, tojson = FALSE)
                
# }

Run the code above in your browser using DataLab