Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 31 additions & 3 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,33 @@
^.*\.Rproj$
^\.Rproj\.user$
^CITATION\.cff$
^CRAN-RELEASE$
^CRAN-SUBMISSION$
^Dockerfile$
^LICENSE\.md$
^Meta$
^README\.Rmd$
^\.travis\.yml$
^appveyor\.yml$
^README\.html$
^\.Renviron$
^\.Rproj\.user$
^\.ccache$
^\.dockerignore$
^\.editorconfig$
^\.github$
^\.gitignore$
^\.httr-oauth$
^\.ignore$
^\.lintr$
^\.pre-commit-config\.yaml$
^\.vscode$
^_pkgdown\.yml$
^codecov\.yml$
^compose\.ya?ml$
^cran-comments\.md$
^data-raw$
^doc$
^docs$
^inst/extdata/.+\.R$
^man-roxygen$
^paper$
^pkgdown$
^revdep$
1 change: 1 addition & 0 deletions .github/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.html
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
50 changes: 50 additions & 0 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
release:
types: [published]
workflow_dispatch:

name: pkgdown.yaml

permissions: read-all

jobs:
pkgdown:
runs-on: ubuntu-latest
# Only restrict concurrency for non-PR jobs
concurrency:
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::pkgdown, local::.
needs: website

- name: Build site
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
shell: Rscript {0}

- name: Deploy to GitHub pages 🚀
if: github.event_name != 'pull_request'
uses: JamesIves/[email protected]
with:
clean: false
branch: gh-pages
folder: docs
34 changes: 34 additions & 0 deletions .github/workflows/quick-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [dev]
pull_request:
branches: [dev]

name: R-CMD-check.yaml

permissions: read-all

jobs:
R-CMD-check:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes
steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
needs: check

- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'
40 changes: 33 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,32 +1,58 @@
# History files
.Rhistory
.Rapp.history
*icloud*

# Session Data files
.RData
.RDataTmp

# User-specific files
.Ruserdata

# Example code in package build process
*-Ex.R

# Output files from R CMD build
/*.tar.gz

# Output files from R CMD check
/*.Rcheck/

# RStudio files
.Rproj.user/

# produced vignettes
vignettes/*.html
vignettes/*.pdf
vignettes/*.R
doc/
Meta/

# OAuth2 token, see https://github.com/hadley/httr/releases/tag/v0.3
.httr-oauth

# knitr and R markdown default cache directories
/*_cache/
*_cache/
/cache/

# Temporary files created by R markdown
*.utf8.md
*.knit.md
.Rproj.user
inst/doc

# complete data files in /data-raw/
/data-raw/*.csv
# R Environment Variables
.Renviron

# pkgdown site
docs/

# translation temp files
po/*~

# RStudio Connect folder
rsconnect/

# CRAN
CRAN-RELEASE
CRAN-SUBMISSION

# MacOS
.DS_Store
4 changes: 0 additions & 4 deletions .travis.yml

This file was deleted.

46 changes: 29 additions & 17 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,26 +1,38 @@
Package: refundr
Type: Package
Package: refundr
Title: Tidier regression with functional data
Version: 0.1.0
Date: 2019-08-30
Authors@R: c(person("Julia", "Wrobel", email = "[email protected]", role = c("aut", "cre")),person("Fabian", "Scheipl", email = "[email protected]", role = c("aut")), person("Sara", "Kim", email = "[email protected]", role = c("aut")),person("Jeff", "Goldsmith", role = c("aut")))
Description: Interfaces key functions from the refund package with framework from the tidyfun package to provide a tidier interface to FPCA and regression for functional data.
Depends: R (>= 3.4)
Authors@R: c(
person("Julia", "Wrobel", , "[email protected]", role = c("aut", "cre")),
person("Fabian", "Scheipl", , "[email protected]", role = "aut"),
person("Sara", "Kim", , "[email protected]", role = "aut"),
person("Jeff", "Goldsmith", role = "aut")
)
Description: Interfaces key functions from the refund package with
framework from the tidyfun package to provide a tidier interface to
FPCA and regression for functional data.
License: GPL-3
Depends:
R (>= 3.4)
Imports:
dplyr,
gamm4,
MASS,
Matrix,
mgcv,
stats,
rlang,
tidyfun,
dplyr,
gamm4,
MASS,
Matrix,
mgcv,
rlang,
stats,
tidyfun,
tidyr
Remotes: github::tidyfun/tidyfun@dev
License: GPL-3
Suggests:
modelr,
testthat,
tibble,
tidyverse
Remotes:
github::tidyfun/tidyfun@dev
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.1.1
Suggests:
testthat, tibble, tidyverse, modelr
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.2
11 changes: 5 additions & 6 deletions R/refundr-package.R
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
#' refundr
#'
#'
#'@description `refundr` makes functional data analyses
#' in `R` more consistent and user friendly\cr\cr
#'@description
#' `refundr` makes functional data analyses in `R` more consistent and
#' user friendly\cr\cr
#' `refundr` provides:
#' - tidy interface for common fpca methods and funcional regression
#' - plays nice with the `tidyfun` package for wrangling functional data
#'
#' Also see `vignette("refundr")` for a brief introduction.
#'
#' @name refundr
#' @docType package
NULL
#' @keywords internal
"_PACKAGE"
45 changes: 19 additions & 26 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@ output: github_document
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "##",
fig.width = 8,
fig.height = 5.5,
out.width = "90%"
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)


library(tidyverse)
library(tidyfun)
library(refundr)
Expand All @@ -25,26 +23,22 @@ 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")

scale_colour_discrete <- scale_colour_viridis_d
scale_fill_discrete <- scale_fill_viridis_d
```

# refundr

<!-- badges: start -->
[![Travis build status](https://travis-ci.org/tidyfun/refundr.svg?branch=master)](https://travis-ci.org/tidyfun/refundr)
[![AppVeyor build status](https://ci.appveyor.com/api/projects/status/github/tidyfun/refundr?branch=master&svg=true)](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")
```{r, eval = FALSE}
# install.packages("pak")
pak::pak("tidyfun/refundr")
```

## `rfr_fpca()`
Expand All @@ -54,26 +48,25 @@ The `rfr_fpca()` function peforms `fpca` using functions from the `refund` packa
Below are examples using the dti and chf datasets.


```{r}

```{r, eval = FALSE}
library(refundr)
library(tidyfun)
library(tidyverse)

# irregular data
# 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) +
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 = 0.4) +
geom_spaghetti(aes(y = cca), color = "blue", alpha = 0.3) +
facet_grid(~sex)

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

Loading