Skip to content

Commit

Permalink
fixes for CRAN (release 2.5.8)
Browse files Browse the repository at this point in the history
  • Loading branch information
brownag committed Oct 20, 2020
1 parent acbe36e commit b6f2231
Show file tree
Hide file tree
Showing 11 changed files with 111 additions and 158 deletions.
200 changes: 102 additions & 98 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,98 +1,102 @@
# R 3.3 compatibility:
importFrom("grDevices", "rgb", "convertColor")

importFrom("graphics", "axis", "legend", "mtext", "rect", "segments",
"text", "plot")

importFrom("stats", "aggregate", "complete.cases", "na.omit", "as.formula", "splinefun", "weighted.mean")

importFrom("utils", "URLencode", "download.file", "object.size",
"read.csv", "read.table", "setTxtProgressBar",
"txtProgressBar", "write.table", "type.convert")

importFrom("methods", "slot<-")

importFrom(reshape2,
dcast,
melt
)

importFrom(raster,
readAll,
raster,
extent
)

importFrom(lattice,
panel.abline
)

importFrom(plyr,
ddply,
llply,
ldply,
dlply,
join,
summarize
)


importFrom(sp,
spTransform,
CRS,
proj4string,
"coordinates<-",
"proj4string<-",
SpatialPolygonsDataFrame,
SpatialPointsDataFrame,
SpatialPoints,
spChFIDs
)

importFrom(curl,
curl,
new_handle
)

importFrom(xml2,
read_html,
xml_text
)


importFrom(aqp,
"depths<-",
"site<-",
site,
idname,
parseMunsell,
diagnostic_hz,
horizonDepths,
"diagnostic_hz<-",
restrictions,
"restrictions<-",
SoilTextureLevels,
hzDepthTests,
munsell2rgb,
rgb2munsell,
horizons,
"horizons<-",
metadata,
"metadata<-",
hzidname,
"hzidname<-",
hzdesgnname,
'hzdesgnname<-',
hztexclname,
'hztexclname<-',
profile_id
)

importMethodsFrom(aqp, "plot")
importMethodsFrom(aqp, "length")
importMethodsFrom(aqp, "nrow")
importClassesFrom(aqp, "SoilProfileCollection")



exportPattern("^[^\\.]")
# R 3.3 compatibility:
importFrom("grDevices", "rgb", "convertColor")

importFrom("graphics", "axis", "legend", "mtext", "rect", "segments",
"text", "plot")

importFrom("stats", "aggregate", "complete.cases", "na.omit", "as.formula", "splinefun", "weighted.mean")

importFrom("utils", "URLencode", "download.file", "object.size",
"read.csv", "read.table", "setTxtProgressBar",
"txtProgressBar", "write.table", "type.convert")

importFrom("methods", "slot<-")

importFrom(data.table,
data.table,
as.data.table)

importFrom(reshape2,
dcast,
melt
)

importFrom(raster,
readAll,
raster,
extent
)

importFrom(lattice,
panel.abline
)

importFrom(plyr,
ddply,
llply,
ldply,
dlply,
join,
summarize
)


importFrom(sp,
spTransform,
CRS,
proj4string,
"coordinates<-",
"proj4string<-",
SpatialPolygonsDataFrame,
SpatialPointsDataFrame,
SpatialPoints,
spChFIDs
)

importFrom(curl,
curl,
new_handle
)

importFrom(xml2,
read_html,
xml_text
)


importFrom(aqp,
"depths<-",
"site<-",
site,
idname,
parseMunsell,
diagnostic_hz,
horizonDepths,
"diagnostic_hz<-",
restrictions,
"restrictions<-",
SoilTextureLevels,
hzDepthTests,
munsell2rgb,
rgb2munsell,
horizons,
"horizons<-",
metadata,
"metadata<-",
hzidname,
"hzidname<-",
hzdesgnname,
'hzdesgnname<-',
hztexclname,
'hztexclname<-',
profile_id,
aqp_df_class,
'aqp_df_class<-'
)

importMethodsFrom(aqp, "plot")
importMethodsFrom(aqp, "length")
importMethodsFrom(aqp, "nrow")
importClassesFrom(aqp, "SoilProfileCollection")

exportPattern("^[^\\.]")
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* bug fix for `fetchSDA_spatial` with `chunk.size` > 1 resulting in duplicate data in result
* major improvements to `fetchSDA_spatial` to handle queries that exceed JSON Serialization Limit
* add `fetchSoilGrids` for point data queries to SoilGrids v2 API with SoilProfileCollection output
* `fetchKSSL(..., returnGeochemicalData=TRUE)` now returns geochemical, optical and XRD/thermal data

# soilDB 2.5.6 (2020-06-16)
* bug fixes in `fetchKSSL` related to vectorization, all arguments vectorized except for `bbox`
Expand Down
2 changes: 1 addition & 1 deletion R/SDA-spatial.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#' @param g name of column in \code{d} containing WKT geometry
#' @param p4s PROJ4 CRS definition, typically GCS WGS84
#'
#' @details The SDA website can be found at \url{http://sdmdataaccess.nrcs.usda.gov}. See the \href{http://ncss-tech.github.io/AQP/soilDB/SDA-tutorial.html}{SDA Tutorial} for detailed examples.
#' @details The SDA website can be found at \url{https://sdmdataaccess.nrcs.usda.gov}. See the \href{http://ncss-tech.github.io/AQP/soilDB/SDA-tutorial.html}{SDA Tutorial} for detailed examples.
#'
#' @note This function requires the `httr`, `jsonlite`, `XML`, and `rgeos` packages.
#'
Expand Down
2 changes: 1 addition & 1 deletion R/SDA_query.R
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ format_SQL_in_statement <- function(x) {
#'
#' @description Submit a query to the Soil Data Access (SDA) REST/JSON web-service and return the results as a data.frame. There is a 100,000 record limit and 32Mb JSON serializer limit, per query. Queries should contain a WHERE statement or JOIN condition to limit the number of rows affected / returned. Consider wrapping calls to \code{SDA_query} in a function that can iterate over logical chunks (e.g. areasymbol, mukey, cokey, etc.). The function \code{makeChunks} can help with such iteration.
#'
#' @details The SDA website can be found at \url{http://sdmdataaccess.nrcs.usda.gov} and query examples can be found at \url{http://sdmdataaccess.nrcs.usda.gov/QueryHelp.aspx}. A library of query examples can be found at \url{https://nasis.sc.egov.usda.gov/NasisReportsWebSite/limsreport.aspx?report_name=SDA-SQL_Library_Home}.
#' @details The SDA website can be found at \url{https://sdmdataaccess.nrcs.usda.gov} and query examples can be found at \url{https://sdmdataaccess.nrcs.usda.gov/QueryHelp.aspx}. A library of query examples can be found at \url{https://nasis.sc.egov.usda.gov/NasisReportsWebSite/limsreport.aspx?report_name=SDA-SQL_Library_Home}.
#'
#' SSURGO (detailed soil survey) and STATSGO (generalized soil survey) data are stored together within SDA. This means that queries that don't specify an area symbol may result in a mixture of SSURGO and STATSGO records. See the examples below and the \href{http://ncss-tech.github.io/AQP/soilDB/SDA-tutorial.html}{SDA Tutorial} for details.
#'
Expand Down
2 changes: 1 addition & 1 deletion R/mapunit_geom_by_ll_bbox.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#'
#' @param bbox a bounding box in WGS coordinates
#' @param source the source database, currently limited to soil data access (SDA)
#' @details The SDA website can be found at http://sdmdataaccess.nrcs.usda.gov. See examples for bounding box formatting.
#' @details The SDA website can be found at \url{https://sdmdataaccess.nrcs.usda.gov}. See examples for bounding box formatting.
#' @return A SpatialPolygonsDataFrame of map unit polygons, in WGS84 (long,lat) coordinates.
#' @note SDA does not return the spatial intersection of map unit polygons and bounding box. Rather, just those polygons that are completely within the bounding box / overlap with the bbox. This function requires the 'rgdal' package.
#'
Expand Down
3 changes: 1 addition & 2 deletions man/OSDquery.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@
\value{a \code{data.frame} object containing soil series names that match patterns supplied as arguments.}

\references{

\url{http://www.nrcs.usda.gov/wps/portal/nrcs/detailfull/soils/home/?cid=nrcs142p2_053587}
\url{https://www.nrcs.usda.gov/wps/portal/nrcs/detailfull/soils/home/?cid=nrcs142p2_053587}
}

\author{D.E. Beaudette}
Expand Down
2 changes: 1 addition & 1 deletion man/SDA_query.Rd

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

2 changes: 1 addition & 1 deletion man/mapunit_geom_by_ll_bbox.Rd

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

2 changes: 1 addition & 1 deletion man/processSDA_WKT.Rd

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

51 changes: 0 additions & 51 deletions man/us_ss_timeline.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -30,55 +30,4 @@ This data was web scraped from the NRCS Soils Website. The scraping procedure an
https://www.nrcs.usda.gov/wps/portal/nrcs/soilsurvey/soils/survey/state/
}

\examples{
\donttest{
if (requireNamespace("curl") &
curl::has_internet() &
require("XML") &
require("RCurl") &
require("ggplot2") &
require("gridExtra")
) {

data(state)
st <- paste0(c(state.abb, "PR", "DC", "VI", "PB"))
us_ss_timeline <- {
lapply(st, function(x) {
cat("getting", x, "\n")
url <- getURL(paste0(
"https://www.nrcs.usda.gov/wps/portal/nrcs/surveylist/soils/survey/state/?stateId=", x)
)
df <- readHTMLTable(url, which = 22, stringsAsFactors = FALSE)
df$state <- x
return(df)
}) ->.;
do.call("rbind", .) ->.;
names(.) <- c("ssa", "year", "pdf", "wss", "state")
.[!grepl(.$year, pattern="current"), ] ->.;
}
us_ss_timeline <- within(us_ss_timeline, {
ssa = sapply(ssa, function(x) strsplit(x, "\r")[[1]][1])
year = as.numeric(substr(year, 3,6))
pdf = ifelse(pdf == "Yes", TRUE, FALSE)
wss = NULL
})

test <- as.data.frame(table(us_ss_timeline$year), stringsAsFactors = FALSE)

g1 <- ggplot(data = test, aes(x = Var1, y = Freq)) +
geom_histogram(stat = "identity") +
xlab("Year") +
ylab("Count") +
theme(aspect.ratio = 1) +
ggtitle("Number of Published \n US Soil Surveys by Year")
g2 <- ggplot(test, aes(x = Var1, y = cumsum(Freq))) +
geom_histogram(stat = "identity") +
xlab("Year") +
ylab("Count") +
theme(aspect.ratio = 1) +
ggtitle("Cumulative Number of Published \n US Soil Surveys by Year")

grid.arrange(g1, g2, ncol = 2)

}}}
\keyword{datasets}
2 changes: 1 addition & 1 deletion misc/man-deprecated/fetchOSD.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ These last two cases are problematic for analysis that makes use of morphology a
\value{a \code{SoilProfileCollection} object containing basic soil morphology and taxonomic information.}

\references{
USDA-NRCS OSD search tools: \url{http://www.nrcs.usda.gov/wps/portal/nrcs/detailfull/soils/home/?cid=nrcs142p2_053587}
USDA-NRCS OSD search tools: \url{https://www.nrcs.usda.gov/wps/portal/nrcs/detailfull/soils/home/?cid=nrcs142p2_053587}
}

\author{D.E. Beaudette}
Expand Down

0 comments on commit b6f2231

Please sign in to comment.