Skip to content

Commit

Permalink
Merge branch 'main' into 79-new-function-install-depricated-package
Browse files Browse the repository at this point in the history
  • Loading branch information
SanderDevisscher committed Oct 11, 2024
2 parents 84f6ff0 + 26a9dd7 commit 5dc78fc
Show file tree
Hide file tree
Showing 35 changed files with 332 additions and 80 deletions.
6 changes: 2 additions & 4 deletions .github/ISSUE_TEMPLATE/nieuwe-functie-aanmaken.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ assignees: ''
- [ ] list of the expected functionality

## Checklist
- [ ] maak een nieuw R-bestand
- [ ] maak een nieuw R-bestand
- [ ] vermijd `library("package")` en `require("package")` gebruik `package::function()` *of als het echt niet anders gaat `requirenamespace("package")`*
- [ ] sla het R bestand op onder `./R` met filenaam is gelijk aan functienaam
- [ ] voorzie een functie titel met `#'` op regel 1 van je script
- [ ] voorzie een auteur met `#' @author`
Expand All @@ -26,9 +27,6 @@ assignees: ''
- [ ] voer `roxygen2::roxygenise()` uit in de console
- [ ] voer `devtools::check()` uit in de console
- [ ] los eventuele errors, warnings en notes<sup>1</sup> op
- [ ] increment versie dmv `usethis::use_version(which = "minor")`<sup>2</sup>
- [ ] maak een pull request met @soriadelva of @SanderDevisscher en eventueel andere relevante gebruikers als reviewer.

*<sup>1</sup>in de mate van het mogelijke*

*<sup>2</sup>als je meer dan 5 functies en/of datasets in één pull request veranderd hebt gebruik: `usethis::use_version(which = "major")`*
5 changes: 2 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: fistools
Title: Tools & data used for wildlife management & invasive species in Flanders
Version: 1.2.8
Version: 1.2.11
Authors@R: c(
person(given = "Sander", middle = "", family = "Devisscher", "sander.devisscher@inbo.be",
role = c("aut", "cre"), comment = c(ORCID = "0000-0003-2015-5731")),
Expand Down Expand Up @@ -37,5 +37,4 @@ Imports:
sp (>= 2.1.4),
mapview (>= 2.11.2),
osmdata (>= 0.2.5),
readr (>= 2.1.5),
RCurl (>= 1.98.1.16)
readr (>= 2.1.5)
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export(install_depricated)
export(install_sp)
export(label_converter)
export(label_selecter)
export(rename_ct_files)
importClassesFrom(sp,CRS)
importFrom(magrittr,"%>%")
importFrom(sp,CRS)
Expand Down
4 changes: 2 additions & 2 deletions R/CRS_extracter.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@
CRS_extracter <- function(CRS,
EPSG = TRUE){

install_sp()
fistools::install_sp()

Lib_CRS <- lib_crs
Lib_CRS <- fistools::lib_crs

if(grepl("wgs", CRS, ignore.case = TRUE)){
CRS <- "WGS"
Expand Down
52 changes: 52 additions & 0 deletions R/rename_ct_files.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#' Rename camera trap files for upload in Agouti
#'
#' @author: Lynn Pallemaerts and Someone Before Her
#'
#' @description Function that rename camera trap files (i.e. photos) by
#' appending folder name (e.g. 1000RECX) to file name (e.g. IMG0001) to create
#' all unique file names across a deployment. Needed for deployments with more
#' than 9999 pictures, so they can be uploaded in Agouti. This is a copy of the
#' old `rename_file_names()` in the old `fis-projecten` (archived).
#'
#' @param foldername DCIM folder to be treated
#' @param extensions file extensions to be rename. Default is jpg, jpeg, bmp and png
#'
#' @returns renamed picture files in the original folder
#'
#' @examples
#' \dontrun{
#' tempzip <- tempfile(fileext = ".zip")
#' fistools::download_gdrive_if_missing(gfileID = "1-84hbKouLKGwnLgBSRaQO1BnfogoFZWz",
#' destfile = tempzip,
#' email = Sys.getenv("email"),
#' update_always = TRUE)
#'
#' foldername <- paste0(tempdir(), "/test_case_renaming")
#' unzip(tempzip,
#' exdir = tempdir())
#' rename_ct_files(foldername)
#' browseURL(foldername)
#' unlink(foldername,
#' recursive = TRUE)
#'}
#'
#' @export

rename_ct_files <- function(foldername,
extensions = c("jpg", "png", "jpeg", "bmp")) {

# list all the files in the subfolders and prepare new file names
images <- dir(foldername, recursive = TRUE, full.names = FALSE) %>%
as.data.frame(stringsAsFactors = FALSE) %>%
dplyr::select(filename = ".") %>%
dplyr::filter(grepl(paste0(extensions, collapse = "|"), tolower(filename))) %>%
dplyr::mutate(subfolder = dirname(filename)) %>%
dplyr::mutate(foldername = foldername) %>%
dplyr::mutate(new_filename = gsub("/", "_", filename)) %>%
dplyr::mutate(full_filename = as.character(file.path(foldername, filename))) %>%
dplyr::mutate(full_new_filename = as.character(file.path(foldername, subfolder, new_filename)))

# execute file renaming
file.rename(images$full_filename, images$full_new_filename)

}
4 changes: 2 additions & 2 deletions docs/404.html

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

4 changes: 2 additions & 2 deletions docs/CODE_OF_CONDUCT.html

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

4 changes: 2 additions & 2 deletions docs/LICENSE-text.html

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

4 changes: 2 additions & 2 deletions docs/LICENSE.html

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

8 changes: 4 additions & 4 deletions docs/authors.html

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

4 changes: 2 additions & 2 deletions docs/index.html

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

4 changes: 2 additions & 2 deletions docs/pkgdown.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pandoc: 2.9.2.1
pkgdown: 2.1.0
pkgdown: 2.1.1
pkgdown_sha: ~
articles: {}
last_built: 2024-09-04T17:33Z
last_built: 2024-10-10T13:48Z
4 changes: 2 additions & 2 deletions docs/reference/CRS_extracter.html

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

4 changes: 2 additions & 2 deletions docs/reference/UUID_List.html

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

4 changes: 2 additions & 2 deletions docs/reference/apply_grtsdb.html

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

4 changes: 2 additions & 2 deletions docs/reference/boswachterijen.html

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

4 changes: 2 additions & 2 deletions docs/reference/calculate_polygon_centroid.html

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

4 changes: 2 additions & 2 deletions docs/reference/check.html

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

4 changes: 2 additions & 2 deletions docs/reference/cleanup_sqlite.html

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

4 changes: 2 additions & 2 deletions docs/reference/col_content_compare.html

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

Loading

0 comments on commit 5dc78fc

Please sign in to comment.