Skip to content

Commit

Permalink
minor adjustments to code style, adressed R CMD Check error and notes
Browse files Browse the repository at this point in the history
  • Loading branch information
the-Hull committed Feb 11, 2024
1 parent 6c60070 commit 29079f1
Show file tree
Hide file tree
Showing 9 changed files with 97 additions and 28 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@
^cran-comments\.md$
^README\.md$
^NEWS\.md$
^\.github$
1 change: 1 addition & 0 deletions .github/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.html
48 changes: 48 additions & 0 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
with:
clean: false
branch: gh-pages
folder: docs
5 changes: 1 addition & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
4 changes: 0 additions & 4 deletions R/is.trex.R
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down
4 changes: 1 addition & 3 deletions R/package-TREX.R
Original file line number Diff line number Diff line change
Expand Up @@ -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 <doi: 10.1111/nph.15241>).
#' @docType package
#' @name TREX
NULL
"_PACKAGE"
8 changes: 4 additions & 4 deletions R/tdm_damp.R
Original file line number Diff line number Diff line change
Expand Up @@ -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))),
Expand All @@ -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 <-
Expand Down Expand Up @@ -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))),
Expand All @@ -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 <-
Expand Down
41 changes: 41 additions & 0 deletions man/TREX-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 0 additions & 13 deletions man/TREX.Rd

This file was deleted.

0 comments on commit 29079f1

Please sign in to comment.