Skip to content

Commit

Permalink
v1.2.0.9002
Browse files Browse the repository at this point in the history
- fix: Replace `rgdal` functions with ones from `sf` package, Issue \#44
- refactor: Remove XLConnect, Issue \#48
  - DESCRIPTION, Suggests
  - MBSStools_vignette
- fixe: Vignette now builds, Issue \#33
  • Loading branch information
leppott committed Oct 15, 2024
1 parent be09e1f commit 76c8b01
Show file tree
Hide file tree
Showing 12 changed files with 1,845 additions and 3,154 deletions.
10 changes: 4 additions & 6 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Description: Suite of tools for data manipulation and calculations for Maryland
DNR MBSS program. Includes functions for calculating FIBI, BIBI (MBSS
genus), BIBI (MSW family), PHI, flow sums, ion contributions, and taxa
distribution maps.
Version: 1.2.0.9001
Version: 1.2.0.9002
Authors@R: c(
person("Erik W.", "Leppo", email="[email protected]", role=c("aut","cre")),
person("Ann","Roseberry Lincoln", role="ctb"),
Expand All @@ -14,10 +14,9 @@ Depends: R (>= 3.4.0)
License: GPL (>= 3)
Encoding: UTF-8
URL: https://github.com/leppott/MBSStools
RoxygenNote: 7.3.1
RoxygenNote: 7.3.2
Imports:
dplyr,
rgdal
dplyr
Suggests:
DT,
ggplot2,
Expand All @@ -30,8 +29,7 @@ Suggests:
shiny,
shinyjs,
sp,
testthat,
XLConnect
testthat
VignetteBuilder: knitr
LazyData: true
BugReports: https://github.com/leppott/MBSStools/issues
10 changes: 9 additions & 1 deletion NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@ NEWS-MBSStools

<!-- NEWS.md is generated from NEWS.Rmd. Please edit that file -->

#> Last Update: 2024-04-08 12:38:08.080495
#> Last Update: 2024-10-15 12:37:10.670714

# MBSStools v1.2.0.9002 (2024-04-08)

- fix: Replace `rgdal` functions with ones from `sf` package, Issue \#44
- refactor: Remove XLConnect, Issue \#48
- DESCRIPTION, Suggests
- MBSStools_vignette
- fixe: Vignette now builds, Issue \#33

# MBSStools v1.2.0.9001 (2024-04-08)

Expand Down
10 changes: 9 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@ NEWS-MBSStools

<!-- NEWS.md is generated from NEWS.Rmd. Please edit that file -->

#> Last Update: 2024-04-08 12:38:08.080495
#> Last Update: 2024-10-15 12:37:10.670714

# MBSStools v1.2.0.9002 (2024-04-08)

- fix: Replace `rgdal` functions with ones from `sf` package, Issue \#44
- refactor: Remove XLConnect, Issue \#48
- DESCRIPTION, Suggests
- MBSStools_vignette
- fixe: Vignette now builds, Issue \#33

# MBSStools v1.2.0.9001 (2024-04-08)

Expand Down
9 changes: 9 additions & 0 deletions NEWS.rmd
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@ knitr::opts_chunk$set(
cat(paste0("Last Update: ",Sys.time()))
```

MBSStools v1.2.0.9002 (2024-04-08)
================

* fix: Replace `rgdal` functions with ones from `sf` package, Issue #44
* refactor: Remove XLConnect, Issue #48
+ DESCRIPTION, Suggests
+ MBSStools_vignette
* fixe: Vignette now builds, Issue #33

MBSStools v1.2.0.9001 (2024-04-08)
================
* fix: Update examples and vignette to not use droplevels()
Expand Down
57 changes: 30 additions & 27 deletions R/MapTaxaObs.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
#' Tests for existence of Data, GIS directories and required files. On failure,
#' stops and prints missing directories/files to screen.
#'
#' The R libraries rgdal, sf, and readxl are required for this function.
#' The R libraries `rgdal`, `sf`, and `readxl` are required for this function.
#' The `rgdal` package was deprecated in 2023. In 2024 revised this fucntion to
#' use functions from the `sf` package.
#'
#' @param obs Excel file containing 3 columns: TaxaName, Latitude83, Longitude83
#' @param xWalk Crosswalk (Excel file) of taxa names between taxa name in
Expand Down Expand Up @@ -71,6 +73,9 @@
#'
#' # Create maps
#' MapTaxaObs(obs, xWalk, dirMain)
#'
#' # Open folder (Windows only)
#' # shell.exec(tempdir())
#
#' @export
MapTaxaObs <- function(obs
Expand Down Expand Up @@ -123,8 +128,6 @@ MapTaxaObs <- function(obs
# shell.exec(dirMain)
}## IF ~ boo_QC ~ END



# 2021-01-10
# Define missing variables
# bindings for global variables -----
Expand Down Expand Up @@ -273,15 +276,6 @@ MapTaxaObs <- function(obs
ppi <- 72
#dsn<-paste(dirMain,dirGIS,sep="/")
dsn <- file.path(dirMain, dirGIS)
# state <- rgdal::readOGR(dsn = dsn
# , layer = "MD_State_Boundary"
# , verbose=verbose)
# coastline <- rgdal::readOGR(dsn = dsn
# , layer = "MD_Coast_Hydrology"
# , verbose=verbose)
# counties <- rgdal::readOGR(dsn = dsn
# , layer = "MD_Boundary_County_Detailed"
# , verbose=verbose)

# sf version
state <- sf::st_read(dsn = dsn
Expand All @@ -307,30 +301,39 @@ MapTaxaObs <- function(obs
, pointsize = 12
, bg = "white")
plot(sf::st_geometry(state)
, col="white"
, col = "white"
, border = "gray")
plot(sf::st_geometry(coastline)
, add = TRUE
, col = "light blue"
, border=FALSE)
, border = FALSE)
plot(sf::st_geometry(counties)
, add = TRUE
, col = "white"
, border = "darkslategray"
, lwd = 0.5)
#xy <- df.taxon.sites[,2:3]
proj.sites <- rgdal::project(cbind(df.taxon.sites$Longitude83
, df.taxon.sites$Latitude83)
,
"+proj=lcc +lat_1=39.45 +lat_2=38.3 +lat_0=37.66666666666666 +lon_0=-77
+x_0=400000 +y_0=0 +datum=NAD83 +units=m +no_defs")
graphics::points(proj.sites[, 1]
, proj.sites[, 2]
, pch = 21
, col = "black"
, bg = "green"
, cex = 1.0)

### sites
# 4326, WGS 84
# 6487, NAD83(2011)/Maryland in meters
# 6488, NAD83(2011)/Maryland in US survey feet
# 26985, NAD83/Maryland *this one*
# 2248
sites_wgs84 <- sf::st_as_sf(df.taxon.sites,
coords = c("Longitude83", "Latitude83"),
crs = 4326)
sites_nad83md_m <- sf::st_transform(sites_wgs84, crs = 26985)
#### plot
plot(sites_nad83md_m,
pch = 21,
col = "black",
bg = "green",
cex = 1.0,
type = "p",
add = TRUE)

grDevices::dev.off()

# user feedback
if (verbose == TRUE) {##IF.verbose.START
message(paste0("Saving map "
Expand All @@ -344,7 +347,7 @@ MapTaxaObs <- function(obs
}##IF.verbose.END
##PLOT.END
}##FOR.i.END
#

# 6. Clean up ####
# Number on Non-Matches
n.nomatch <- nrow(df.taxa.nomatch)
Expand Down
Loading

0 comments on commit 76c8b01

Please sign in to comment.