## 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)
Run the code above in your browser using DataLab