ape: Interfaces for ape package for data science pipelines.

Description Usage Arguments Details Value Author(s) Examples

Description

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

Usage

1
2
3
4
5

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
## Not run: 
library(intubate)
library(magrittr)
library(ape)

## ntbt_binaryPGLMM: Phylogenetic Generalized Linear Mixed Model for Binary Data
n <- 100
phy <- compute.brlen(rtree(n=n), method = "Grafen", power = 1)
X1 <- rTraitCont(phy, model = "BM", sigma = 1)
X1 <- (X1 - mean(X1))/var(X1)
sim.dat <- data.frame(Y=array(0, dim=n), X1=X1, row.names=phy$tip.label)
sim.dat$Y <- binaryPGLMM.sim(Y ~ X1, phy = phy, data = sim.dat, s2 = .5,
                             B = matrix(c(0, .25), nrow = 2, ncol = 1), nrep = 1)$Y

## Original function to interface
binaryPGLMM(Y ~ X1, phy = phy, data = sim.dat)

## The interface puts data as first parameter
ntbt_binaryPGLMM(sim.dat, Y ~ X1, phy = phy)

## so it can be used easily in a pipeline.
sim.dat %>%
  ntbt_binaryPGLMM(Y ~ X1, phy = phy)


## ntbt_compar.gee: Comparative Analysis with GEEs
tr <- "((((Homo:0.21,Pongo:0.21):0.28,Macaca:0.49):0.13,Ateles:0.62):0.38,Galago:1.00);"
tree.primates <- read.tree(text = tr)
dta <- data.frame(X = c(4.09434, 3.61092, 2.37024, 2.02815, -1.46968),
                  Y = c(4.74493, 3.33220, 3.36730, 2.89037, 2.30259))
rownames(dta) <- tree.primates$tip.label

## Original function to interface
compar.gee(X ~ Y, phy = tree.primates, data = dta)

## The interface puts data as first parameter
ntbt_compar.gee(dta, X ~ Y, phy = tree.primates)

## so it can be used easily in a pipeline.
dta %>%
  ntbt_compar.gee(X ~ Y, phy = tree.primates)


## ntbt_correlogram.formula: Phylogenetic Correlogram
data(carnivora)

## Original function to interface
correlogram.formula(SW ~ Order/SuperFamily/Family/Genus,
                    data = carnivora)

## The interface puts data as first parameter
ntbt_correlogram.formula(carnivora, SW ~ Order/SuperFamily/Family/Genus)

## so it can be used easily in a pipeline.
carnivora %>%
  ntbt_correlogram.formula(SW ~ Order/SuperFamily/Family/Genus)


## ntbt_lmorigin: Multiple regression through the origin
data(lmorigin.ex1)

## Original function to interface
lmorigin(SO2 ~ ., data = lmorigin.ex1, origin = FALSE, nperm = 99)

## The interface puts data as first parameter
ntbt_lmorigin(lmorigin.ex1, SO2 ~ ., origin = FALSE, nperm = 99)

## so it can be used easily in a pipeline.
lmorigin.ex1 %>%
  ntbt_lmorigin(SO2 ~ ., origin = FALSE, nperm = 99)

## ntbt_yule.cov: Fits the Yule Model With Covariates
data(bird.orders)
dta <- data.frame (x = rnorm(45))

## Original function to interface
yule.cov(bird.orders, ~ x, data = dta)

## The interface puts data as first parameter
ntbt_yule.cov(dta, bird.orders, ~ x)

## so it can be used easily in a pipeline.
dta %>%
  ntbt_yule.cov(bird.orders, ~ x)

## End(Not run)

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