lars: Interfaces for lars package for data science pipelines.

Description Usage Arguments Details Value Author(s) Examples

Description

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

Usage

1
2

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


library(ISLR)
data("Hitters")
Hitters <- na.omit(Hitters)

dta <- list(x = model.matrix(Salary ~ ., Hitters)[, -1],  ## Remove intercept
            y = model.frame(Salary ~ ., Hitters)[, 1])

## ntbt_lars: Fits Least Angle Regression, Lasso and Infinitesimal
##            Forward Stagewise regression models

## Original function to interface
attach(dta)
lasso <- lars(x, y)
plot(lasso)
detach()

## The interface puts data as first parameter
lasso <- ntbt_lars(dta, x, y)
plot(lasso)

## so it can be used easily in a pipeline.
dta %>%
  ntbt_lars(x, y) %>%
  plot()


## ntbt_cv.lars: Computes K-fold cross-validated error curve for lars

## Original function to interface
set.seed(1)
attach(dta)
cv.lars(x, y)
detach()

## The interface puts data as first parameter
set.seed(1)
ntbt_cv.lars(dta, x, y)

## so it can be used easily in a pipeline.
set.seed(1)
dta %>%
  ntbt_cv.lars(x, y)

## End(Not run)

rbertolusso/intubate documentation built on May 27, 2019, 3 a.m.