-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathREADME.Rmd
More file actions
79 lines (56 loc) · 1.71 KB
/
Copy pathREADME.Rmd
File metadata and controls
79 lines (56 loc) · 1.71 KB
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
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
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
<!-- badges: start -->
[](https://travis-ci.org/tidyfun/refundr)
[](https://ci.appveyor.com/project/tidyfun/refundr)
<!-- badges: end -->
The goal of **`refundr`** is to interface **`refund`** and **`tidyfun`**.
## Installation
``` r
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.
```{r}
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)
```