Closed ashtonmj closed 3 years ago
As time (workload) permits I'll investigate.
Thanks! Seems like that specific error is a hot topic on GH after recent updates to R and package dependencies. Trying some package updates. Currently using 3.4.0 and wondering if an incompatible (3.4.1) devtools and its dependencies are the issue.
Ran fine in testing on my machine.
session_info() Session info ----------------------------------------------------------------------------------------- setting value
version R version 3.4.3 (2017-11-30) system i386, mingw32
ui RStudio (1.1.383)
language (EN)
collate English_United States.1252
tz America/New_York
date 2018-05-11
Ran example from ?MapTaxaObs
Reloading installed MBSStools
Reload library
library(myLibrary,character.only = TRUE)
change wd back to package
setwd(paste0("./",myLibrary))
~~~~~~~~~~library(MBSStools) ?MapTaxaObs
Set Working Directory
wd <- getwd()
Create Example Data if Needed
Create Directories
myDir.create <- file.path(wd,"Data") ifelse(dir.exists(myDir.create)==FALSE,dir.create(myDir.create),"Directory already exists") [1] "Directory already exists" myDir.create <- file.path(wd,"GIS") ifelse(dir.exists(myDir.create)==FALSE,dir.create(myDir.create),"Directory already exists") [1] TRUE myDir.create <- file.path(wd,"Maps") ifelse(dir.exists(myDir.create)==FALSE,dir.create(myDir.create),"Directory already exists") [1] TRUE
Create Data
Taxa Data
myFiles <- c("AllFish_95to16.xls", "TaxaMapsCrossWalk20170731.xlsx") file.copy(file.path(path.package("MBSStools"),"extdata",myFiles),file.path(wd,"Data",myFiles)) [1] TRUE TRUE
GIS
unzip(file.path(path.package("MBSStools"),"extdata","MD_GIS.zip"),exdir=file.path(wd,"GIS"))
Inputs
Obs <- "AllFish_95to16.xls" XWalk <- "TaxaMapsCrossWalk20170731.xlsx" wd <- getwd()
Create maps
MapTaxaObs(Obs, XWalk, wd) C:/Users/Erik.Leppo/OneDrive - Tetra Tech, Inc/MyDocs_OneDrive/GitHub/MBSStools OGR data source with driver: ESRI Shapefile Source: "C:/Users/Erik.Leppo/OneDrive - Tetra Tech, Inc/MyDocs_OneDrive/GitHub/MBSStools/GIS", layer: "MD_State_Boundary" with 2 features It has 9 fields Integer64 fields read as strings: OBJECTID OGR data source with driver: ESRI Shapefile Source: "C:/Users/Erik.Leppo/OneDrive - Tetra Tech, Inc/MyDocs_OneDrive/GitHub/MBSStools/GIS", layer: "MD_Coast_Hydrology" with 1117 features It has 9 fields Integer64 fields read as strings: OBJECTID OGR data source with driver: ESRI Shapefile Source: "C:/Users/Erik.Leppo/OneDrive - Tetra Tech, Inc/MyDocs_OneDrive/GitHub/MBSStools/GIS", layer: "MD_Boundary_County_Detailed" with 24 features It has 7 fields Integer64 fields read as strings: OBJECTID DISTRICT COUNTY_FIP COUNTYNUM Saving map 1 of 77; alewife. Saving map 2 of 77; american eel. Saving map 3 of 77; american shad. SNIP Saving map 75 of 77; white sucker. Saving map 76 of 77; yellow bullhead. Saving map 77 of 77; yellow perch. There are 54 non-matching taxa names. The non-matches are saved in a table with the maps.
Another user having issues with MapTaxaObs function.
.. I think I've run into an error. ,,, It seems like it has something to do with formatting in one of the "MD_Boundary_County_Detailed" files. I tried running both my own data and the code from the vignette in the helpfile and have gotten the same error (see end of output below). Any information would be greatly appreciated!
MapTaxaObs(Obs, XWalk, wd) X:/JWatson/ForJAy OGR data source with driver: ESRI Shapefile Source: "X:/JWatson/ForJAy/GIS", layer: "MD_State_Boundary" with 2 features It has 9 fields Integer64 fields read as strings: OBJECTID OGR data source with driver: ESRI Shapefile Source: "X:/JWatson/ForJAy/GIS", layer: "MD_Coast_Hydrology" with 1117 features It has 9 fields Integer64 fields read as strings: OBJECTID OGR data source with driver: ESRI Shapefile Source: "X:/JWatson/ForJAy/GIS", layer: "MD_Boundary_County_Detailed" with 24 features It has 7 fields Integer64 fields read as strings: OBJECTID DISTRICT COUNTY_FIP COUNTYNUM Error in as.double(y) : cannot coerce type 'S4' to vector of type 'double'
Matt's fix was to upgrade to v3.4.0 and all dependent packages.
Should update DESCRIPTION to specify minimum version of R as 3.4.0.
Modified DESCRIPTION for minimum version of R and moved rgdal and dplyr packages from Suggests to Imports to ensure they are loaded on user's computer when MBSStools is called.
Function example fails.
Relevant code that still has a hard coded directory and not the input parameter.
Updated function example variables to match the function inputs.
Works with edits but get errors.
If reload package rgdal
then it works fine.
Still getting error even when reload rgdal
.
Erik, I have had major issues with anything related to rgdal around the transition from 3.5 to 3.6. After I went to 3.6.3 R and higher seems to have taken care of whatever bug. Lots of Stackoverflow and other gripping about errors from the package not being able to load, reinstall, etc.
Matt Ashton
Resource Assessment Service
Department of Natural Resources
580 Taylor Ave., C-2
Annapolis, Maryland 21401
@.***
(410) 260-8604 (O)
(443) 775-0069 (M)
Website http://dnr.maryland.gov | Facebook https://www.facebook.com/MarylandDNR/ | Twitter http://twitter.com/MarylandDNR Click here http://www.doit.state.md.us/selectsurvey/TakeSurvey.aspx?agencycode=DNR&SurveyID=86M2956# to complete a three question customer experience survey.
On Thu, Jun 17, 2021 at 12:51 PM Erik Leppo @.***> wrote:
Still getting error even when reload rgdal.
[image: image] https://user-images.githubusercontent.com/24276278/122440592-b3812380-cf6a-11eb-9c5e-349cad4cb8bc.png
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/leppott/MBSStools/issues/17#issuecomment-863401090, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJKZ5WKMVIKQJRKWYSYPIOLTTIRZHANCNFSM4E7IUYKA .
Switching to sf
package instead of rdgal
for loading and mapping of the three shapefiles in this function.
The "state.shp" was the one causing the issues. With sf
package no errors.
Error when running MapTaxObs function when loading the county boundary shapefile from GIT.
First ran the function with the directories that already existed in my wd. After the error I deleted the GIS and Maps directories and re-ran the function pulling the GIS data from GIT, but got the same error.