Skip to content

Commit

Permalink
Merge pull request #257 from DylanCarbone/pull_requests
Browse files Browse the repository at this point in the history
Improvements to occDetFunc tests and dependency function tests
  • Loading branch information
AugustT authored Apr 11, 2024
2 parents 0396a45 + 761caf3 commit 3c1ef21
Show file tree
Hide file tree
Showing 32 changed files with 4,571 additions and 1,836 deletions.
3 changes: 3 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ frescalo.exe
^docs$
misc/
^appveyor\.yml$
^\.github$
^doc$
^Meta$
1 change: 1 addition & 0 deletions .github/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.html
51 changes: 51 additions & 0 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# 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: [master, pull_requests]
pull_request:
branches: [master, pull_requests]

name: R-CMD-check

jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}

name: ${{ matrix.config.os }} (${{ matrix.config.r }})

strategy:
fail-fast: false
matrix:
config:
- {os: macos-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v4

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

- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
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-build-vignettes", "--no-manual")'
args: 'c("--no-vignettes", "--no-manual")'
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# History files
# History files and data files
.Rhistory
.Rdata

# Example code in package build process
*-Ex.R
Expand All @@ -11,3 +12,5 @@ frescalo.exe
sparta.Rproj

misc/
/doc/
/Meta/
43 changes: 0 additions & 43 deletions .travis.yml

This file was deleted.

69 changes: 43 additions & 26 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,40 +1,57 @@
Package: sparta
Type: Package
Package: sparta
Title: Trend Analysis for Unstructured Data
Version: 0.2.19
Date: 2020-05-26
Authors@R: c(person("Tom", "August", role = c("aut", "cre"), email = "[email protected]"),
person("Gary", "Powney", role = c("aut")),
person("Charlie", "Outhwaite", role = c("aut")),
person("Colin", "Harrower", role = c("aut")),
person("Mark", "Hill", role = c("aut")),
person("Jack", "Hatfield", role = c("aut")),
person("Francesca", "Mancini", role = c("aut")),
person("Nick", "Isaac", role = c("aut")))
Maintainer: Tom August <[email protected]>
Description: Methods used to analyse trends in unstructured
occurrence datasets such as those collected by volunteer recording
schemes.
Authors@R: c(
person("Dylan", "Carbone", email = "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0009-0003-5290-786X")),
person("Tom", "August", email = "[email protected]", role = "aut",
comment = c(ORCID = "0000-0003-1116-3385")),
person("Gary", "Powney", role = "aut",
comment = c(ORCID = "0000-0003-3313-7786")),
person("Charlie", "Outhwaite", role = "aut",
comment = c(ORCID = "0000-0001-9997-6780")),
person("Jack", "Hatfield", role = "aut",
comment = c(ORCID = "0000-0002-6361-0629")),
person("Nick", "Isaac", role = "aut",
comment = c(ORCID = "0000-0002-4869-8052")),
person("Francesca", "Mancini", role = "aut",
comment = c(ORCID = "0000-0003-4085-4978")),
person("Mark", "Hill", role = "aut",
comment = c(ORCID = "0000-0002-3323-4458")),
person("Colin", "Harrower", role = "aut",
comment = c(ORCID = "0000-0001-5070-5293"))
)
Maintainer: Dylan Carbone <[email protected]>
Description: Methods used to analyse trends in unstructured occurrence
datasets such as those collected by volunteer recording schemes.
License: MIT + file LICENSE
URL: https://github.com/BiologicalRecordsCentre/sparta
BugReports: https://github.com/BiologicalRecordsCentre/sparta/issues
Depends:
R (>= 3.1.0),
lme4 (>= 1.0)
lme4 (>= 1.0),
R (>= 3.5.0)
Imports:
plyr,
boot,
dplyr (>= 0.4.1),
sp,
reshape2,
ggplot2,
gdata,
ggplot2,
LearnBayes,
plyr,
reshape2,
rmarkdown,
boot
sp,
xfun (>= 0.4.3)
Suggests:
testthat (>= 0.8.0),
roxygen2,
knitr,
R2jags
VignetteBuilder: knitr
LazyData: TRUE
RoxygenNote: 7.1.1
R2jags,
roxygen2,
testthat (>= 0.8.0),
VignetteBuilder:
knitr
Encoding: UTF-8
LazyData: TRUE
RoxygenNote: 7.2.3
SystemRequirements: JAGS
(https://sourceforge.net/projects/mcmc-jags/files/JAGS/)
8 changes: 7 additions & 1 deletion R/formatOccData.r
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@
#' closure_period = closure_period)
#'
#' # format the unicorns data
#'
#' unicorns <- unicorns[complete.cases(unicorns$kmsq), ]
#'
#' formatted_data <- formatOccData(taxa = unicorns$CONCEPT,
#' survey = unicorns$Date,
#' site = unicorns$kmsq)
Expand Down Expand Up @@ -134,14 +137,17 @@ formatOccData <- function(taxa, site, survey, replicate = NULL, closure_period =
temp <- group_by(.data = taxa_data, survey, replicate)

temp <- summarise(temp, ns = length(unique(TP)))

if(any(temp$ns) > 1) {
# return a warning but assume they know what they're doing
warning(paste(as.numeric(table(temp$ns >1)[2]), 'survey identities appear in multiple closure periods'))
}

} else {
# we need to create the TP from the survey date.
# survey should be a date if we've got this far, so extract the year
taxa_data$TP <- as.numeric(format(taxa_data$survey,'%Y')) # take year from date year
taxa_data$TP <- as.numeric(format(taxa_data$survey, format = '%Y')) # take year from date year

}

# remove duplicates (in order that List Length is correctly calculated)
Expand Down
Loading

0 comments on commit 3c1ef21

Please sign in to comment.