knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "##",
  fig.width = 8, 
  fig.height = 5.5,
  out.width = "90%"
)


library(tidyverse)
library(tidyfun)
library(refundr)
library(viridisLite)

theme_set(theme_minimal() + theme(legend.position = "bottom"))

options(
  ggplot2.continuous.colour = "viridis",
  ggplot2.continuous.fill = "viridis"
)
scale_colour_discrete = scale_colour_viridis_d
scale_fill_discrete = scale_fill_viridis_d

library("refundr")

refundr

Travis build status AppVeyor build status

The goal of refundr is to interface refund and tidyfun.

Installation

devtools::install_github("tidyfun/refundr")

rfr_fpca()

The rfr_fpca() function peforms fpca using functions from the refund package. The input is a tfd column.

Below are examples using the dti and chf datasets.

library(refundr)
library(tidyfun)
library(tidyverse)

# irregular data 
data(dti_df)
dti_fpca = rfr_fpca(Y = "cca", data = dti_df)

dti_df %>% 
  modelr::add_predictions(dti_fpca, var = "cca_fits") %>% 
  filter(case == "control") %>% 
  ggplot(aes(y = cca_fits)) + 
  geom_spaghetti(alpha = .4) + 
  geom_spaghetti(aes(y = cca), color = "blue", alpha = .3) + 
  facet_grid(~sex)

# regular data
data(chf_df)
dti_fpca = rfr_fpca(Y = "activity", data = chf_df)


tidyfun/refundr documentation built on March 26, 2022, 4:09 p.m.