README.md

Project Status: Active - The project has reached a stable, usable state and is being actively developed. Travis-CI Build Status CRAN_Status_Badge CRAN RStudio mirror downloads

The LAGOSNE package provides an R interface to download LAGOS-NE data from remote databases, store this data locally, and perform a variety of filtering and subsetting operations.

Installation

# install stable version from CRAN
install.packages("LAGOSNE")

# install development version from Github
# install devtools if not found - install.packages("devtools")
# devtools::install_github("cont-limno/LAGOSNE", update_dependencies = TRUE)

Data

The lagosne_get function downloads the LAGOSNE files corresponding to the specified version from the EDI data repository. Files are stored in a temporary directory before being "compiled" to an R data format in the location returned by rappdirs::user_data_dir(). Data only needs to be downloaded one time per version per machine. The latest version of the LAGOSNE dataset is 1.087.1.

library(LAGOSNE)
lagosne_get("1.087.1")

Usage

Load Package

library(LAGOSNE)

Load data

The lagosne_load function returns a named list of data.frame objects. Use the names() function to see a list of available data.frames.

dt <- lagosne_load(version = "1.087.1")
names(dt)
#>  [1] "county"               "county.chag"          "county.conn"         
#>  [4] "county.lulc"          "edu"                  "edu.chag"            
#>  [7] "edu.conn"             "edu.lulc"             "hu4"                 
#> [10] "hu4.chag"             "hu4.conn"             "hu4.lulc"            
#> [13] "hu8"                  "hu8.chag"             "hu8.conn"            
#> [16] "hu8.lulc"             "hu12"                 "hu12.chag"           
#> [19] "hu12.conn"            "hu12.lulc"            "iws"                 
#> [22] "iws.conn"             "iws.lulc"             "state"               
#> [25] "state.chag"           "state.conn"           "state.lulc"          
#> [28] "buffer100m"           "buffer100m.lulc"      "buffer500m"          
#> [31] "buffer500m.conn"      "buffer500m.lulc"      "lakes.geo"           
#> [34] "epi_nutr"             "lakes_limno"          "secchi"              
#> [37] "lagos_source_program" "locus"

Preview a table

head(dt$county)
#>   county_state       county_name county_ha_in_nwi county_ha county_zoneid
#> 1           CT  Fairfield County         167421.8  168044.3      County_1
#> 2           IL       Ford County         125912.3  125912.3     County_10
#> 3           IL      Stark County          74682.0   74682.0    County_100
#> 4           IL Stephenson County         146269.3  146269.3    County_101
#> 5           IL   Tazewell County         170204.0  170204.0    County_102
#> 6           IL  Vermilion County         233543.6  233543.6    County_103
#>   county_pct_in_nwi county_lat conty_long
#> 1               100   41.27225  -73.38940
#> 2               100   40.59720  -88.22340
#> 3               100   41.09336  -89.79749
#> 4               100   42.35175  -89.66246
#> 5               100   40.50731  -89.51343
#> 6               100   40.18342  -87.73293

Read table metadata

help.search("datasets", package = "LAGOSNE")

| Package | Topic | Title | |:--------|:----------------|:-----------------------------------------| | LAGOSNE | chag | CHAG Datasets | | LAGOSNE | classifications | LAGOSNE Spatial Classifications Metadata | | LAGOSNE | conn | Connectivity Datasets | | LAGOSNE | epi_nutr | Epilimnion Water Quality Data | | LAGOSNE | lagoslakes | Lake Geospatial Metadata | | LAGOSNE | lakes_limno | Metadata for Lakes with Water Quality | | LAGOSNE | lg_extent | LAGOSNE extent | | LAGOSNE | lg_subset | LAGOSNE subset | | LAGOSNE | locus | Metadata for all lakes > 1ha | | LAGOSNE | lulc | Land Use Land Cover (LULC) Data Frames | | LAGOSNE | secchi | Secchi (Water Clarity) Data | | LAGOSNE | source | LAGOSNE sources |

Select data

lagosne_select is a convenience function whose primary purpose is to provide users with the ability to select subsets of LAGOS tables that correspond to specific keywords (see LAGOSNE:::keyword_partial_key() and LAGOSNE:::keyword_full_key()). See here for a comprehensive tutorial on generic data.frame subsetting.

# specific variables
 head(lagosne_select(table = "epi_nutr", vars = c("tp", "tn")))
#>   tp tn
#> 1 30 NA
#> 2 10 NA
#> 3  5 NA
#> 4  9 NA
#> 5  5 NA
#> 6 27 NA
 head(lagosne_select(table = "iws.lulc", vars = c("iws_nlcd2011_pct_95")))
#>   iws_nlcd2011_pct_95
#> 1                2.77
#> 2                2.97
#> 3                0.27
#> 4                0.00
#> 5                0.00
#> 6                0.00

# categories
head(lagosne_select(table = "locus", categories = "id"))
#>   lagoslakeid iws_zoneid hu4_zoneid hu6_zoneid hu8_zoneid hu12_zoneid
#> 1           1  IWS_45400     HU4_12     HU6_15     HU8_49  HU12_16694
#> 2           2  IWS_41585      HU4_7     HU6_10     HU8_41  HU12_16612
#> 3           3  IWS_44511     HU4_12     HU6_15     HU8_49  HU12_16694
#> 4           4  IWS_42712     HU4_10     HU6_11     HU8_35  HU12_16625
#> 5           5  IWS_42817     HU4_10     HU6_11     HU8_35  HU12_16621
#> 6           6  IWS_43912     HU4_11     HU6_12     HU8_47  HU12_16684
#>   edu_zoneid county_zoneid state_zoneid
#> 1     EDU_75    County_319      State_2
#> 2     EDU_27    County_319      State_2
#> 3     EDU_75    County_319      State_2
#> 4     EDU_58    County_326      State_2
#> 5     EDU_58    County_322      State_2
#> 6     EDU_27    County_331      State_2
head(lagosne_select(table = "epi_nutr", categories = "waterquality"))
#>   chla colora colort dkn doc nh4 no2 no2no3 srp tdn tdp tkn tn toc ton tp
#> 1   NA     NA     NA  NA  NA  20  NA     20  NA  NA  NA  NA NA  NA  NA 30
#> 2   NA     NA     NA  NA  NA  20  NA     20  NA  NA  NA  NA NA  NA  NA 10
#> 3  3.9     NA     15  NA  NA  NA  NA     NA  NA  NA  NA  NA NA  NA  NA  5
#> 4  4.8     NA     15  NA  NA  NA  NA     NA  NA  NA  NA  NA NA  NA  NA  9
#> 5  2.1     NA     NA  NA  NA  NA  NA     NA  NA  NA  NA  NA NA  NA  NA  5
#> 6  6.6     15     NA  NA  NA  NA  NA     NA  NA  NA  NA  NA NA  NA  NA 27
#>   secchi
#> 1     NA
#> 2     NA
#> 3    6.5
#> 4    5.8
#> 5    6.1
#> 6    2.4
head(lagosne_select(table = "county.chag", categories = "hydrology"))
#>   county_baseflowindex_min county_baseflowindex_max
#> 1                       45                       55
#> 2                       30                       35
#> 3                       28                       35
#> 4                       34                       66
#> 5                       22                       40
#> 6                       28                       37
#>   county_baseflowindex_mean county_baseflowindex_std
#> 1                   48.3755                   1.8683
#> 2                   32.6106                   1.4480
#> 3                   31.5548                   1.3772
#> 4                   53.1078                   4.6081
#> 5                   32.4689                   4.1342
#> 6                   34.4157                   1.1100
#>   county_groundwaterrecharge_min county_groundwaterrecharge_max
#> 1                            242                            333
#> 2                             70                             87
#> 3                             63                             79
#> 4                             76                            149
#> 5                             49                             90
#> 6                             69                            101
#>   county_groundwaterrecharge_mean county_groundwaterrecharge_std
#> 1                        287.8918                        13.2835
#> 2                         77.6043                         3.5242
#> 3                         70.8356                         3.1289
#> 4                        119.9809                         9.9839
#> 5                         72.9695                         9.3241
#> 6                         86.4779                         4.2264
#>   county_runoff_min county_runoff_max county_runoff_mean county_runoff_std
#> 1           19.9786           25.2231            23.4650            0.9777
#> 2            9.4569            9.9058             9.6548            0.1075
#> 3            8.6985            8.8649             8.7751            0.0424
#> 4            8.7637            9.0521             8.9578            0.0758
#> 5            8.7336            9.0239             8.9134            0.0680
#> 6            9.7732           10.8360            10.0258            0.2073
head(lagosne_select(table = "hu4.chag", categories = "deposition")[,1:4])
#>   hu4_dep_no3_1985_min hu4_dep_no3_1985_max hu4_dep_no3_1985_mean
#> 1               7.2171              10.0448                7.9366
#> 2               9.5538              21.1791               15.5290
#> 3              15.5222              22.8936               19.6234
#> 4               8.5831              31.3832               17.2809
#> 5              15.6669              24.2653               19.0625
#> 6              12.6550              26.8946               18.1940
#>   hu4_dep_no3_1985_std
#> 1               0.3868
#> 2               2.2330
#> 3               1.3634
#> 4               3.2954
#> 5               1.5500
#> 6               1.8389

# mix of specific variables and categories
head(lagosne_select(table = "epi_nutr", vars = "programname", 
                    categories = c("id", "waterquality")))
#>        programname lagoslakeid chla colora colort dkn doc nh4 no2 no2no3
#> 1      MA_DEP_CHEM           2   NA     NA     NA  NA  NA  20  NA     20
#> 2      MA_DEP_CHEM           2   NA     NA     NA  NA  NA  20  NA     20
#> 3 MA_DEP_2005_2010           2  3.9     NA     15  NA  NA  NA  NA     NA
#> 4 MA_DEP_2005_2010           2  4.8     NA     15  NA  NA  NA  NA     NA
#> 5 MA_DEP_2005_2010           2  2.1     NA     NA  NA  NA  NA  NA     NA
#> 6      MA_DEP_CHEM           3  6.6     15     NA  NA  NA  NA  NA     NA
#>   srp tdn tdp tkn tn toc ton tp secchi eventida1087
#> 1  NA  NA  NA  NA NA  NA  NA 30     NA            4
#> 2  NA  NA  NA  NA NA  NA  NA 10     NA            5
#> 3  NA  NA  NA  NA NA  NA  NA  5    6.5            6
#> 4  NA  NA  NA  NA NA  NA  NA  9    5.8            7
#> 5  NA  NA  NA  NA NA  NA  NA  5    6.1            8
#> 6  NA  NA  NA  NA NA  NA  NA 27    2.4            9

Published LAGOSNE subsets

# Oliver et al. 2015
lagos_get_oliver_2015()
dt <- lagos_load_oliver_2015()
head(dt)
#>   lagoslakeid     nhdid hu4id lat_decimal long_decimal   area zmaxobs
#> 1           1  50524769   202    42.54739    -73.17425 114.95     2.7
#> 2           2 123632625   108    42.18409    -73.04728  24.87     6.1
#> 3           3  50524793   202    42.53081    -73.19155  75.41     1.8
#> 4           4 135695054   109    42.45435    -71.14079   9.26     5.2
#> 5           5 135693974   109    42.60405    -70.82267  14.00     3.4
#> 6           6 122373608   110    42.14209    -72.11992  80.29    13.7
#>   zmaxpredict
#> 1        10.6
#> 2         7.1
#> 3         8.6
#> 4         3.7
#> 5         5.4
#> 6        10.1

Legacy Versions

R Package

To install versions of LAGOSNE compatible with older versions of LAGOS-NE run the following command where ref is set to the desired version (in the example, it is version 1.054.1):

# install devtools if not found
# install.packages("devtools")
devtools::install_github("cont-limno/LAGOSNE", ref = "v1.054.1")

Data

Until older datasets have been made available in a public repository, LAGOSNE users will need to use the lagosne_compile function (not lagosne_get) and supply the path to their local locus, limno and geo data folders. Replace the paths in the example below with the path to each respective folder on your system. Most people will have access to these folders through Dropbox. For example, the limno_folder would be assigned to something like: C:/Users/FWL/Dropbox/CSI_LAGOS-exports/LAGOS-NE-LIMNO-EXPORT

library(LAGOSNE)
lagosne_compile("1.054.1", format = "rds",
  limno_folder = "~/Downloads/LAGOS-NE-LIMNO-EXPORT",
  geo_folder   = "~/Downloads/LAGOS-NE-GEO-EXPORT",
  locus_folder = "~/Downloads/LAGOS-NE-LOCUS-EXPORT")

References

Oliver, SK, PA Soranno, CE Fergus, T Wagner, K Webster, CE Scott, LA Winslow, J Downing, and EH Stanley. 2015. “LAGOS - Predicted and Observed Maximum Depth Values for Lakes in a 17-State Region of the U.S.” https://dx.doi.org/10.6073/pasta/edc06bbae6db80e801b6e52253f2ea09.

Soranno, P.A., Bacon, L.C., Beauchene, M., Bednar, K.E., Bissell, E.G., Boudreau, C.K., Boyer, M.G., Bremigan, M.T., Carpenter, S.R., Carr, J.W. Cheruvelil, K.S., and ... , 2017. LAGOS-NE: A multi-scaled geospatial and temporal database of lake ecological context and water quality for thousands of US lakes. GigaScience, https://doi.org/10.1093/gigascience/gix101

Soranno, PA, EG Bissell, KS Cheruvelil, ST Christel, SM Collins, CE Fergus, CT Filstrup, et al. 2015. “Building a Multi-Scaled Geospatial Temporal Ecology Database from Disparate Data Sources: Fostering Open Science and Data Reuse.” Gigascience 4 (1). https://dx.doi.org/10.1186/s13742-015-0067-4.

Stachelek, J, and SK Oliver. 2017. LAGOSNE: Interface to the Lake Multi-Scaled Geospatial and Temporal Database. https://github.com/cont-limno/LAGOSNE.

Soranno P, Cheruvelil K. 2017. LAGOS-NE-LOCUS v1.01: a module for LAGOS-NE, a multi-scaled geospatial and temporal database of lake ecological context and water quality for thousands of U.S. Lakes: 1925–2013. Environmental Data Initiative. http://doi.org/ckpj

Soranno P, Cheruvelil K. 2017. LAGOS-NE-LIMNO v1.087.1: a module for LAGOS-NE, a multi-scaled geospatial and temporal database of lake ecological context and water quality for thousands of U.S. Lakes: 1925–2013. Environmental Data Initiative. http://doi.org/ckpk.

Soranno P, Cheruvelil K. 2017. LAGOS-NE-GEO v1.05: a module for LAGOS-NE, a multi-scaled geospatial and temporal database of lake ecological context and water quality for thousands of U.S. Lakes: 1925–2013. Environmental Data Initiative. http://doi.org/ckpm



cont-limno/LAGOS documentation built on Oct. 9, 2018, 11:36 p.m.