vcd: Interfaces for vcd package for data science pipelines.

Description Usage Arguments Details Value Author(s) Examples

Description

Interfaces to vcd functions that can be used in a pipeline implemented by magrittr.

Usage

1
2
3
4
5
6
7
8
9

Arguments

data

data frame, tibble, list, ...

...

Other arguments passed to the corresponding interfaced function.

Details

Interfaces call their corresponding interfaced function.

Value

Object returned by interfaced function.

Author(s)

Roberto Bertolusso

Examples

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
## Not run: 
library(intubate)
library(magrittr)
library(vcd)


## ntbt_agreementplot: Bangdiwala's Observer Agreement Chart
## Original function to interface
agreementplot(Freq ~ Gender + Admit, as.data.frame(UCBAdmissions))

## The interface puts data as first parameter
ntbt_agreementplot(as.data.frame(UCBAdmissions), Freq ~ Gender + Admit)

## so it can be used easily in a pipeline.
as.data.frame(UCBAdmissions) %>%
  ntbt_agreementplot(Freq ~ Gender + Admit)


## ntbt_assoc: Extended Association Plots
## Original function to interface
assoc(Freq ~ Gender + Admit, data = as.data.frame(UCBAdmissions))

## The interface puts data as first parameter
ntbt_assoc(as.data.frame(UCBAdmissions), Freq ~ Gender + Admit)

## so it can be used easily in a pipeline.
as.data.frame(UCBAdmissions) %>%
  ntbt_assoc(Freq ~ Gender + Admit)


## ntbt_cd_plot: Conditional Density Plots
data("Arthritis")
## Original function to interface
cd_plot(Improved ~ Age, data = Arthritis)

## The interface puts data as first parameter
ntbt_cd_plot(Arthritis, Improved ~ Age)

## so it can be used easily in a pipeline.
Arthritis %>%
  ntbt_cd_plot(Improved ~ Age)


## ntbt_cotabplot: Coplot for Contingency Tables
## Original function to interface
cotabplot(~ Admit + Gender | Dept, data = UCBAdmissions)

## The interface puts data as first parameter
ntbt_cotabplot(UCBAdmissions, ~ Admit + Gender | Dept)

## so it can be used easily in a pipeline.
UCBAdmissions %>%
  ntbt_cotabplot(~ Admit + Gender | Dept)


## ntbt_loddsratio: Calculate Generalized Log Odds Ratios for Frequency Tables
data(Punishment, package = "vcd")

## Original function to interface
loddsratio(Freq ~ memory + attitude | age + education, data = Punishment)

## The interface puts data as first parameter
ntbt_loddsratio(Punishment, Freq ~ memory + attitude | age + education)

## so it can be used easily in a pipeline.
Punishment %>%
  ntbt_loddsratio(Freq ~ memory + attitude | age + education)


## ntbt_mosaic: Extended Mosaic Plots
library(MASS)
data("Titanic")
mosaic(Titanic)

## Original function to interface
mosaic(~ Sex + Age + Survived, data = Titanic,
       main = "Survival on the Titanic", shade = TRUE, legend = TRUE)

## The interface puts data as first parameter
ntbt_mosaic(Titanic, ~ Sex + Age + Survived,
            main = "Survival on the Titanic", shade = TRUE, legend = TRUE)

## so it can be used easily in a pipeline.
Titanic %>%
  ntbt_mosaic(~ Sex + Age + Survived,
              main = "Survival on the Titanic", shade = TRUE, legend = TRUE)


## ntbt_sieve: Extended Sieve Plots
data("VisualAcuity")

## Original function to interface
sieve(Freq ~ right + left,  data = VisualAcuity)

## The interface puts data as first parameter
ntbt_sieve(VisualAcuity, Freq ~ right + left)

## so it can be used easily in a pipeline.
VisualAcuity %>%
  ntbt_sieve(Freq ~ right + left)


## ntbt_spine: Spine Plots and Spinograms
data("Arthritis")

## Original function to interface
spine(Improved ~ Treatment, data = Arthritis)

## The interface puts data as first parameter
ntbt_spine(Arthritis, Improved ~ Treatment)

## so it can be used easily in a pipeline.
Arthritis %>%
  ntbt_spine(Improved ~ Treatment)


## ntbt_structable: Structured Contingency Tables
## Original function to interface
structable(Sex + Class ~ Survived + Age, data = Titanic)

## The interface puts data as first parameter
ntbt_structable(Titanic, Sex + Class ~ Survived + Age)

## so it can be used easily in a pipeline.
Titanic %>%
  ntbt_structable(Sex + Class ~ Survived + Age)

## End(Not run)

intubate documentation built on May 2, 2019, 2:46 p.m.