diff --git a/.Rbuildignore b/.Rbuildignore index 5a2ff17..9a4e002 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -16,3 +16,4 @@ ^cran-comments\.md$ ^README\.md$ ^NEWS\.md$ +^\.github$ diff --git a/.github/.gitignore b/.github/.gitignore new file mode 100644 index 0000000..2d19fc7 --- /dev/null +++ b/.github/.gitignore @@ -0,0 +1 @@ +*.html diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml new file mode 100644 index 0000000..a7276e8 --- /dev/null +++ b/.github/workflows/pkgdown.yaml @@ -0,0 +1,48 @@ +# 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 + +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/github-pages-deploy-action@v4.5.0 + with: + clean: false + branch: gh-pages + folder: docs diff --git a/DESCRIPTION b/DESCRIPTION index 4b3f1cb..9e0e681 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -53,7 +53,6 @@ BugReports: https://github.com/the-Hull/TREX/issues Encoding: UTF-8 Depends: R (>= 3.5.0) Imports: - chron, zoo, solaR, stats, @@ -67,14 +66,12 @@ Imports: tibble, dplyr, sensitivity, - randtoolbox, - boot, doSNOW, msm, parallel, magrittr, tools -RoxygenNote: 7.1.2 +RoxygenNote: 7.3.1 Suggests: shiny, plotly, diff --git a/R/is.trex.R b/R/is.trex.R index af576e0..bd02ec7 100644 --- a/R/is.trex.R +++ b/R/is.trex.R @@ -280,13 +280,9 @@ is.trex <- #p if (length(unique(timestamp)) == length(unique(left(timestamp,16)))) { - # output.data <- - # zoo::zoo(data$value, order.by = base::as.POSIXct(format(chron::as.chron(timestamp), "%Y-%m-%d %H:%M"),tz="UTC")) output.data <- zoo::zoo(data$value, order.by = base::as.POSIXct(paste0(left(timestamp,16),":00"),tz="UTC")) } else{ - #output.data <- - # zoo::zoo(data$value, order.by = base::as.POSIXct(format(as.character(timestamp), "%Y-%m-%d %H:%M"),tz="UTC")) agg <- stats::aggregate(output.data, by = base::as.POSIXct(paste0(left(timestamp,16),":00"),tz="UTC"), mean) output.data <- zoo::zoo(agg, order.by = base::as.POSIXct(zoo::index(agg),tz="UTC")) diff --git a/R/package-TREX.R b/R/package-TREX.R index 43f6ae4..58671e2 100644 --- a/R/package-TREX.R +++ b/R/package-TREX.R @@ -7,6 +7,4 @@ #' generating uniform data output and visualisation. The package is designed to deal with large quantities of data and apply commonly #' used data-processing methods. The functions have been validated on data collected from different tree species across the northern hemisphere #' (Peters et al. 2018 ). -#' @docType package -#' @name TREX -NULL +"_PACKAGE" diff --git a/R/tdm_damp.R b/R/tdm_damp.R index d1f8be9..ba98cfb 100644 --- a/R/tdm_damp.R +++ b/R/tdm_damp.R @@ -248,7 +248,7 @@ tdm_damp <- function(input, ), control = list(maxiter = 500) ), silent = TRUE) - if (class(report) != "try-error") { + if (!inherits(report, "try-error")) { model_nls <- stats::nls( k.doy ~ ((a + b * run) / (1 + c * run + d * (run ^ 2))), @@ -274,7 +274,7 @@ tdm_damp <- function(input, ), control = list(maxiter = 500) ), silent = TRUE) - if (class(report) == "try-error") { + if (inherits(report, "try-error")) { next } else{ model_nls <- @@ -653,7 +653,7 @@ tdm_damp <- function(input, ), control = list(maxiter = 500) ), silent = TRUE) - if (class(report) != "try-error") { + if (!inherits(report, "try-error")) { model_nls <- stats::nls( k.doy ~ ((a + b * run) / (1 + c * run + d * (run ^ 2))), @@ -679,7 +679,7 @@ tdm_damp <- function(input, ), control = list(maxiter = 500) ), silent = TRUE) - if (class(report) == "try-error") { + if (inherits(report, "try-error")) { next } else{ model_nls <- diff --git a/man/TREX-package.Rd b/man/TREX-package.Rd new file mode 100644 index 0000000..0d3dcd2 --- /dev/null +++ b/man/TREX-package.Rd @@ -0,0 +1,41 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/package-TREX.R +\docType{package} +\name{TREX-package} +\alias{TREX} +\alias{TREX-package} +\title{TREX: TRree sap flow EXtractor.} +\description{ +Performs data assimilation, processing and analyses on sap flow data obtained with the thermal dissipation method (TDM). +The package includes functions for gap filling time-series data, detecting outliers, calculating data-processing uncertainties and, +generating uniform data output and visualisation. The package is designed to deal with large quantities of data and apply commonly +used data-processing methods. The functions have been validated on data collected from different tree species across the northern hemisphere +(Peters et al. 2018 ). +} +\seealso{ +Useful links: +\itemize{ + \item \url{https://the-hull.github.io/TREX/} + \item Report bugs at \url{https://github.com/the-Hull/TREX/issues} +} + +} +\author{ +\strong{Maintainer}: Richard Peters \email{richardlouispeters3@hotmail.com} (\href{https://orcid.org/0000-0002-7441-1297}{ORCID}) [copyright holder] + +Authors: +\itemize{ + \item Christoforos Pappas (\href{https://orcid.org/0000-0001-5721-557X}{ORCID}) [contributor] + \item Alexander Hurley (\href{https://orcid.org/0000-0002-9641-2805}{ORCID}) [contributor] +} + +Other contributors: +\itemize{ + \item Rafael Poyatos [contributor] + \item Victor Flo [contributor] + \item Roman Zweifel [contributor] + \item Willem Goossens [contributor] + \item Kathy Steppe [thesis advisor, etcher, funder] +} + +} diff --git a/man/TREX.Rd b/man/TREX.Rd deleted file mode 100644 index abfc9cf..0000000 --- a/man/TREX.Rd +++ /dev/null @@ -1,13 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/package-TREX.R -\docType{package} -\name{TREX} -\alias{TREX} -\title{TREX: TRree sap flow EXtractor.} -\description{ -Performs data assimilation, processing and analyses on sap flow data obtained with the thermal dissipation method (TDM). -The package includes functions for gap filling time-series data, detecting outliers, calculating data-processing uncertainties and, -generating uniform data output and visualisation. The package is designed to deal with large quantities of data and apply commonly -used data-processing methods. The functions have been validated on data collected from different tree species across the northern hemisphere -(Peters et al. 2018 ). -}