Learn R Programming

intubate (version 1.0.0)

nlme: Interfaces for nlme package for data science pipelines.

Description

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

Usage

ntbt_gls(data, ...) ntbt_lme(data, ...) ntbt_lmList(data, ...) ntbt_nlme(data, ...) ntbt_nlsList(data, ...)

Arguments

data
data frame, tibble, list, ...
...
Other arguments passed to the corresponding interfaced function.

Value

Object returned by interfaced function.

Details

Interfaces call their corresponding interfaced function.

Examples

Run this code
## Not run: 
# library(intubate)
# library(magrittr)
# library(nlme)
# 
# ## gls
# ## Original function to interface
# fm1 <- gls(follicles ~ sin(2*pi*Time) + cos(2*pi*Time), Ovary,
#            correlation = corAR1(form = ~ 1 | Mare))
# summary(fm1)
# 
# ## The interface reverses the order of data and formula
# fm1 <- ntbt_gls(Ovary, follicles ~ sin(2*pi*Time) + cos(2*pi*Time),
#                 correlation = corAR1(form = ~ 1 | Mare))
# summary(fm1)
# 
# ## so it can be used easily in a pipeline.
# Ovary %>%
#   ntbt_gls(follicles ~ sin(2*pi*Time) + cos(2*pi*Time),
#                 correlation = corAR1(form = ~ 1 | Mare))  %>%
#   summary()
#   
# ## nlme
# ## Original function to interface
# lme(distance ~ age, data = Orthodont) # random is ~ age
# lme(distance ~ age + Sex, data = Orthodont, random = ~ 1)
# 
# ## The interface reverses the order of data and formula
# ntbt_lme(data = Orthodont, distance ~ age) # random is ~ age
# ntbt_lme(data = Orthodont, distance ~ age + Sex, random = ~ 1)
# 
# ## so it can be used easily in a pipeline.
# Orthodont %>%
#   ntbt_lme(distance ~ age) # random is ~ age
# Orthodont %>%
#   ntbt_lme(distance ~ age + Sex, random = ~ 1)
# 
# ## lmList
# ## Original function to interface
# lmList(distance ~ age | Subject, Orthodont)
# 
# ## The interface reverses the order of data and formula
# ntbt_lmList(Orthodont, distance ~ age | Subject)
# 
# ## so it can be used easily in a pipeline.
# Orthodont %>%
#   ntbt_lmList(distance ~ age | Subject)
#   
# Orthodont %>%
#   ntbt_lmList(distance ~ age | Subject) %>%
#   summary()
# 
# ## nlme
# ## Original function to interface
# fm1 <- nlme(height ~ SSasymp(age, Asym, R0, lrc),
#             data = Loblolly,
#             fixed = Asym + R0 + lrc ~ 1,
#             random = Asym ~ 1,
#             start = c(Asym = 103, R0 = -8.5, lrc = -3.3))
# summary(fm1)
# 
# ## The interface reverses the order of data and formula
# fm1 <- ntbt_nlme(data = Loblolly,
#                  height ~ SSasymp(age, Asym, R0, lrc),
#                  fixed = Asym + R0 + lrc ~ 1,
#                  random = Asym ~ 1,
#                  start = c(Asym = 103, R0 = -8.5, lrc = -3.3))
# summary(fm1)
# 
# ## so it can be used easily in a pipeline.
# Loblolly %>%
#   ntbt_nlme(height ~ SSasymp(age, Asym, R0, lrc),
#             fixed = Asym + R0 + lrc ~ 1,
#             random = Asym ~ 1,
#             start = c(Asym = 103, R0 = -8.5, lrc = -3.3)) %>%
#   summary()
# ## End(Not run)

Run the code above in your browser using DataLab