mbgraphic (version 1.0.1)

scag2sdf: Calculating (user defined) scagnostics

Description

The function calculates scagnostics for a data frame based on the functions giving by the user and converts them to a list of class "sdfdata".

Usage

scag2sdf(data, scagfun.list, arguments.list = NULL)

Arguments

data

A data frame. If it contains categorical variables, they are excluded.

scagfun.list

A list of functions (see Details).

arguments.list

A list of arguments (see Details).

Value

A list of class "sdfdata" including data frames sdf and data.

sdf

The scagnostics for every single pair of variables for the functions given in scagfun.list.

data

The original data frame minus categorical variables.

Details

scagfun.list is a list of functions. Each of the functions needs to be a function with arguments x (a numeric vector) and y (a numeric vector). The function can also include further parameters, which can be specified in arguments.list.

See Also

scag2sdf

Examples

Run this code
# NOT RUN {
data(Election2005)
# }
# NOT RUN {
set.seed(345456)
election05_small <- Election2005[,sample(5:70,10)]

# Use correlation, distance correlation and a spline based 
# measure as scagnostics.

scagdf <- scag2sdf(election05_small,
    scagfun.list=
      list(cor=cor,dcor2d=dcor2d,splines2d=splines2d))
head(scagdf$sdf)

# Use sperman correlation 
scagdf <- scag2sdf(election05_small,
    scagfun.list=
      list(cor=cor,dcor2d=dcor2d, splines2d=splines2d),
    arguments.list = 
      list(list(method="spearman"),NULL,NULL))
# }

Run the code above in your browser using DataLab