From e1b9b3617821463aa4a8b9547cfd579985d3bee7 Mon Sep 17 00:00:00 2001 From: Ben Young Date: Wed, 10 Jan 2024 21:56:39 -0500 Subject: [PATCH 1/2] sort data commons files by version resolves #32 --- R/UtilityFunctions.R | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/R/UtilityFunctions.R b/R/UtilityFunctions.R index 3a66383..21eb13a 100644 --- a/R/UtilityFunctions.R +++ b/R/UtilityFunctions.R @@ -213,6 +213,10 @@ findLatestStateIODataonDataCommons <- function(filename) { registry <- getRegistryonDataCommons(data_group = "stateio") f <- registry[startsWith(registry$Key, filename) & endsWith(registry$Key, ".rds"), ] + f$version <- sub(paste0(filename, "_"), "", f$Key) + f$version <- sub(".[^.]*$", "", f$version) + # sort so latest version on top in case of duplicate LastModified dates + f <- f[order(f$version, decreasing=TRUE), ] f <- basename(f[which.max(as.Date(f$LastModified)), "Key"]) if (length(f) == 0) { stop(paste(filename, "not avaialble on Data Commons.")) From 37e1c1cd336728a4534eb526f877885a9b08537f Mon Sep 17 00:00:00 2001 From: Ben Young Date: Wed, 10 Jan 2024 22:00:31 -0500 Subject: [PATCH 2/2] update install instructions --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 577db9c..fba50d7 100644 --- a/README.md +++ b/README.md @@ -30,10 +30,15 @@ Install the most recent release version of `stateior` and attach it to the curre ```r install.packages("devtools") -devtools::install_github("USEPA/stateior@0.2.0") +devtools::install_github("USEPA/stateior") library(stateior) ``` +```r +# For a specific release: +devtools::install_github("USEPA/stateior@0.2.1") +``` + Load desired StateIO data. See [One Region Data](format_specs/OneRegionData.md#data) and [Two Region Data](format_specs/TwoRegionData.md#data) for names and details of one- and two-region MRIO data sets that are currently available, respectively. ```r