├── .Rbuildignore
├── .github
├── .gitignore
└── workflows
│ └── pkgdown.yaml
├── .gitignore
├── DESCRIPTION
├── NAMESPACE
├── NEWS.md
├── R
├── SplashDams.R
├── afcon.R
├── alaska.R
├── auckland.R
├── baltimore.R
├── boston.R
├── coffee_data.R
├── columbus.R
├── congruent.R
├── cycle_hire.R
├── cycle_hire_osm.R
├── depmunic.R
├── eire.R
├── elect80.R
├── elev.R
├── getisord.R
├── grain.R
├── hawaii.R
├── hopkins.R
├── house.R
├── huddersfield.R
├── jenks71.R
├── lnd.R
├── nc.sids.R
├── nydata.R
├── nz.R
├── nz_height.R
├── properties.R
├── seine.R
├── state.vbm.R
├── urban_agglomerations.R
├── us_states.R
├── us_states_df.R
├── used.cars.R
├── wheat.R
├── world.R
├── worldbank_df.R
└── zzz.R
├── README.Rmd
├── README.md
├── _pkgdown.yml
├── data-raw
├── create-rasters.R
├── data-download.R
├── data_us_states.R
├── rgdal_read_tests.R
├── save_externally.R
├── update-world.R
├── updates_nz_crs.R
└── world.R
├── data
├── SplashDams.rda
├── afcon.rda
├── aggregating_zones.rda
├── alaska.rda
├── auckland.rda
├── baltimore.rda
├── boston.rda
├── coffee_data.rda
├── columbus.rda
├── congruent.rda
├── cycle_hire.rda
├── cycle_hire_osm.rda
├── depmunic.rda
├── eire.rda
├── elect80.rda
├── getisord.rda
├── hawaii.rda
├── hopkins.rda
├── house.rda
├── huddersfield.rda
├── incongruent.rda
├── jenks71.rda
├── lnd.rda
├── nc.sids.rda
├── nydata.rda
├── nz.rda
├── nz_height.rda
├── properties.rda
├── seine.rda
├── state.vbm.rda
├── urban_agglomerations.rda
├── us_states.rda
├── us_states_df.rda
├── used.cars.rda
├── wheat.rda
├── world.rda
└── worldbank_df.rda
├── inst
├── README
├── misc
│ ├── cycle_hire_xy.csv
│ ├── nyadjwts.dbf
│ ├── nydata.dbf
│ ├── world_wkt.csv
│ └── worldbank_df.csv
├── raster
│ ├── elev.tif
│ ├── grain.tif
│ └── grain.tif.aux.xml
├── shapes
│ ├── NY8_bna_utm18.gpkg
│ ├── NY8_utm18.gpkg
│ ├── auckland.gpkg
│ ├── boston_tracts.gpkg
│ ├── columbus.gpkg
│ ├── cycle_hire.geojson
│ ├── cycle_hire_osm.geojson
│ ├── eire.gpkg
│ ├── sids.gpkg
│ ├── wheat.gpkg
│ └── world.gpkg
└── weights
│ ├── NY_nb.gal
│ ├── baltk4.GWT
│ ├── columbus.gal
│ ├── ncCC89.gal
│ └── ncCR85.gal
├── man
├── SplashDams.Rd
├── afcon.Rd
├── alaska.Rd
├── auckland.Rd
├── baltimore.Rd
├── boston.Rd
├── coffee_data.Rd
├── columbus.Rd
├── congruent.Rd
├── cycle_hire.Rd
├── cycle_hire_osm.Rd
├── depmunic.Rd
├── eire.Rd
├── elect80.Rd
├── elev.tif.Rd
├── figures
│ └── logo.png
├── getisord.Rd
├── grain.tif.Rd
├── hawaii.Rd
├── hopkins.Rd
├── house.Rd
├── huddersfield.Rd
├── jenks71.Rd
├── lnd.Rd
├── nc.sids.Rd
├── nydata.Rd
├── nz.Rd
├── nz_height.Rd
├── properties.Rd
├── seine.Rd
├── state.vbm.Rd
├── urban_agglomerations.Rd
├── us_states.Rd
├── us_states_df.Rd
├── used.cars.Rd
├── wheat.Rd
├── world.Rd
└── worldbank_df.Rd
└── spData.Rproj
/.Rbuildignore:
--------------------------------------------------------------------------------
1 | ^.*\.Rproj$
2 | ^\.Rproj\.user$
3 | ^\.travis\.yml$
4 | ^docs$
5 | ^README\.Rmd$
6 | ^README-.*\.png$
7 | ^data-raw$
8 | ^_pkgdown\.yml$
9 | ^CRAN-RELEASE$
10 | ^pkgdown$
11 | ^\.github$
12 | ^CRAN-SUBMISSION$
13 | ^pkgdown$
14 |
--------------------------------------------------------------------------------
/.github/.gitignore:
--------------------------------------------------------------------------------
1 | *.html
2 |
--------------------------------------------------------------------------------
/.github/workflows/pkgdown.yaml:
--------------------------------------------------------------------------------
1 | # Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
2 | # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
3 | on:
4 | push:
5 | branches: [main, master]
6 | pull_request:
7 | branches: [main, master]
8 | release:
9 | types: [published]
10 | workflow_dispatch:
11 |
12 | name: pkgdown
13 |
14 | jobs:
15 | pkgdown:
16 | runs-on: ubuntu-latest
17 | # Only restrict concurrency for non-PR jobs
18 | concurrency:
19 | group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
20 | env:
21 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
22 | steps:
23 | - uses: actions/checkout@v2
24 |
25 | - uses: r-lib/actions/setup-pandoc@v2
26 |
27 | - uses: r-lib/actions/setup-r@v2
28 | with:
29 | use-public-rspm: true
30 | extra-repositories: https://jakubnowosad.com/drat
31 |
32 | - uses: r-lib/actions/setup-r-dependencies@v2
33 | with:
34 | extra-packages: any::downlit, any::pkgdown, local::.
35 | needs: website
36 |
37 | - name: Build site
38 | run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
39 | shell: Rscript {0}
40 |
41 | - name: Deploy to GitHub pages 🚀
42 | if: github.event_name != 'pull_request'
43 | uses: JamesIves/github-pages-deploy-action@4.1.4
44 | with:
45 | clean: false
46 | branch: gh-pages
47 | folder: docs
48 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .Rproj.user
2 | .Rhistory
3 | .RData
4 | .Ruserdata
5 | docs
6 |
--------------------------------------------------------------------------------
/DESCRIPTION:
--------------------------------------------------------------------------------
1 | Package: spData
2 | Title: Datasets for Spatial Analysis
3 | Version: 2.3.4
4 | Authors@R: c(person("Roger", "Bivand", role = "aut", email="Roger.Bivand@nhh.no", comment = c(ORCID = "0000-0003-2392-6140")),
5 | person("Jakub", "Nowosad", role = c("aut", "cre"), email="nowosad.jakub@gmail.com", comment = c(ORCID = "0000-0002-1057-3721")),
6 | person("Robin", "Lovelace", role = "aut", comment = c(ORCID = "0000-0001-5679-6536")),
7 | person("Angelos", "Mimis", role = "ctb"),
8 | person("Mark", "Monmonier", role = "ctb", comment = "author of the state.vbm dataset"),
9 | person("Greg", "Snow", role = "ctb", comment = "author of the state.vbm dataset")
10 | )
11 | Description: Diverse spatial datasets for demonstrating, benchmarking and teaching spatial data analysis.
12 | It includes R data of class sf (defined by the package 'sf'), Spatial ('sp'), and nb ('spdep').
13 | Unlike other spatial data packages such as 'rnaturalearth' and 'maps',
14 | it also contains data stored in a range of file formats including GeoJSON and GeoPackage, but from version 2.3.4, no longer ESRI Shapefile - use GeoPackage instead.
15 | Some of the datasets are designed to illustrate specific analysis techniques.
16 | cycle_hire() and cycle_hire_osm(), for example, is designed to illustrate point pattern analysis techniques.
17 | Depends:
18 | R (>= 3.3.0)
19 | Imports:
20 | sp
21 | Suggests:
22 | foreign,
23 | sf (>= 0.9-1),
24 | spDataLarge (>= 0.4.0),
25 | spdep,
26 | spatialreg
27 | License: CC0
28 | RoxygenNote: 7.3.2
29 | LazyData: true
30 | URL: https://jakubnowosad.com/spData/
31 | BugReports: https://github.com/Nowosad/spData/issues
32 | Additional_repositories: https://jakubnowosad.com/drat
33 | Encoding: UTF-8
34 |
--------------------------------------------------------------------------------
/NAMESPACE:
--------------------------------------------------------------------------------
1 | # Generated by roxygen2: do not edit by hand
2 |
3 | importClassesFrom(sp,SpatialPointsDataFrame)
4 | importClassesFrom(sp,SpatialPolygonsDataFrame)
5 |
--------------------------------------------------------------------------------
/NEWS.md:
--------------------------------------------------------------------------------
1 | # spData 2.3.4
2 |
3 | * Removes ESRI Shapefile versions of all datasets
4 |
5 | # spData 2.3.3
6 |
7 | * Specifies CRS of the `nz` and `nz_height` objects to `ESPG:2193`
8 |
9 | # spData 2.3.2
10 |
11 | * Adds the `shapes/NY8_utm18.gpkg` file
12 |
13 | # spData 2.3.1
14 |
15 | * Adds a `NEWS.md` file to track changes to the package.
16 | * We added GeoPackage versions of all the datasets in the package (and we plan to remove the ESRI Shapefile versions in the near future).
17 |
--------------------------------------------------------------------------------
/R/SplashDams.R:
--------------------------------------------------------------------------------
1 | #' @name SplashDams
2 | #' @aliases SplashDams
3 | #' @title Data for Splash Dams in western Oregon
4 | #'
5 | #' @description Data for Splash Dams in western Oregon
6 | #'
7 | #' @format Formal class 'SpatialPointsDataFrame with 232 obs. of 6 variables:
8 | #' \itemize{
9 | #' \item{streamName} {}
10 | #' \item{locationCode} {}
11 | #' \item{height} {}
12 | #' \item{lastDate} {}
13 | #' \item{owner} {}
14 | #' \item{datesUsed} {}
15 | #' }
16 | #'
17 | #' @source R. R. Miller (2010) Is the Past Present? Historical Splash-dam Mapping and Stream Disturbance Detection in the Oregon Coastal Province. MSc. thesis, Oregon State University; packaged by Jonathan Callahan
18 | #' @docType data
19 | #' @keywords datasets sp
20 | #' @importClassesFrom sp SpatialPointsDataFrame
21 | #'
22 | #' @examples
23 | #' if (requireNamespace("sp", quietly = TRUE)) {
24 | #' library(sp)
25 | #' data(SplashDams)
26 | #' plot(SplashDams, axes=TRUE)
27 | #' }
28 | "SplashDams"
29 |
--------------------------------------------------------------------------------
/R/afcon.R:
--------------------------------------------------------------------------------
1 | #' @name afcon
2 | #' @aliases afcon africa.rook.nb afxy paper.nb
3 | #' @title Spatial patterns of conflict in Africa 1966-78
4 | #'
5 | #' @description The \code{afcon} data frame has 42 rows and 5 columns, for 42 African countries, exclusing then South West Africa and Spanish Equatorial Africa and Spanish Sahara. The dataset is used in Anselin (1995), and downloaded from before adaptation. The neighbour list object \code{africa.rook.nb} is the SpaceStat \file{rook.GAL}, but is not the list used in Anselin (1995) - \code{paper.nb} reconstructs the list used in the paper, with inserted links between Mauritania and Morocco, South Africa and Angola and Zambia, Tanzania and Zaire, and Botswana and Zambia. \code{afxy} is the coordinate matrix for the centroids of the countries.
6 | #'
7 | #' @format This data frame contains the following columns:
8 | #' \itemize{
9 | #' \item{x: an easting in decimal degrees (taken as centroid of shapefile polygon)}
10 | #' \item{y: an northing in decimal degrees (taken as centroid of shapefile polygon)}
11 | #' \item{totcon: index of total conflict 1966-78}
12 | #' \item{name: country name}
13 | #' \item{id: country id number as in paper}
14 | #' }
15 | #'
16 | #' @source
17 | #' Anselin, L. and John O'Loughlin. 1992. Geography of international conflict and cooperation: spatial dependence and regional context in Africa. In The New Geopolitics, ed. M. Ward, pp. 39-75. Philadelphia, PA: Gordon and Breach.
18 | #' also:
19 | #' Anselin, L. 1995. Local indicators of spatial association, Geographical Analysis, 27, Table 1, p. 103.
20 | #' @note All source data files prepared by Luc Anselin, Spatial Analysis Laboratory, Department of Agricultural and Consumer Economics, University of Illinois, Urbana-Champaign.
21 | #' @docType data
22 | #' @keywords datasets spdep
23 | #'
24 | #' @examples
25 | #' data(afcon)
26 | #' if (requireNamespace("spdep", quietly = TRUE)) {
27 | #' library(spdep)
28 | #' plot(africa.rook.nb, afxy)
29 | #' plot(diffnb(paper.nb, africa.rook.nb), afxy, col="red", add=TRUE)
30 | #' text(afxy, labels=attr(africa.rook.nb, "region.id"), pos=4, offset=0.4)
31 | #' moran.test(afcon$totcon, nb2listw(africa.rook.nb))
32 | #' moran.test(afcon$totcon, nb2listw(paper.nb))
33 | #' geary.test(afcon$totcon, nb2listw(paper.nb))
34 | #' }
35 | "afcon"
36 |
--------------------------------------------------------------------------------
/R/alaska.R:
--------------------------------------------------------------------------------
1 | #' @name alaska
2 | #' @title Alaska multipolygon
3 | #'
4 | #' @description The object loaded is a \code{sf} object containing the state of
5 | #' Alaska from the US Census Bureau
6 | #' with a few variables from American Community Survey (ACS)
7 | #'
8 | #' @format Formal class 'sf' [package "sf"]; the data contains a data.frame with 1 obs. of 7 variables:
9 | #' \itemize{
10 | #' \item{GEOID: character vector of geographic identifiers}
11 | #' \item{NAME: character vector of state names}
12 | #' \item{REGION: character vector of region names}
13 | #' \item{AREA: area in square kilometers of units class}
14 | #' \item{total_pop_10: numerical vector of total population in 2010}
15 | #' \item{total_pop_15: numerical vector of total population in 2015}
16 | #' \item{geometry: sfc_MULTIPOLYGON}
17 | #' }
18 | #' The object is in projected coordinates using Alaska Albers (EPSG:3467).
19 | #'
20 | #' @seealso
21 | #' See the tigris package: https://cran.r-project.org/package=tigris
22 | #'
23 | #' @source \url{https://www.census.gov/geographies/mapping-files/time-series/geo/tiger-line-file.html}
24 | #' @docType data
25 | #' @keywords datasets sf
26 | #' @examples
27 | #' if (requireNamespace("sf", quietly = TRUE)) {
28 | #' library(sf)
29 | #' data(alaska)
30 | #'
31 | #' plot(alaska["total_pop_15"])
32 | #' }
33 | "alaska"
34 |
--------------------------------------------------------------------------------
/R/auckland.R:
--------------------------------------------------------------------------------
1 | #' @name auckland
2 | #' @aliases auckland auckland.nb auckpolys
3 | #' @title Marshall's infant mortality in Auckland dataset
4 | #'
5 | #' @description (Use \code{example(auckland)} to load the data from shapefile and generate neighbour list on the fly). The \code{auckland} data frame has 167 rows (census area units --- CAU) and 4 columns. The dataset also includes the "nb" object \code{auckland.nb} of neighbour relations based on contiguity, and the "polylist" object \code{auckpolys} of polygon boundaries for the CAU. The \code{auckland} data frame includes the following columns:
6 | #'
7 | #' @format This data frame contains the following columns:
8 | #' \itemize{
9 | #' \item{Easting: a numeric vector of x coordinates in an unknown spatial reference system}
10 | #' \item{Northing: a numeric vector of y coordinates in an unknown spatial reference system}
11 | #' \item{M77_85: a numeric vector of counts of infant (under 5 years of age) deaths in Auckland, 1977-1985}
12 | #' \item{Und5_81: a numeric vector of population under 5 years of age at the 1981 Census}
13 | #' }
14 | #'
15 | #' @details The contiguous neighbours object does not completely replicate results in the sources, and was reconstructed from \code{auckpolys}; examination of figures in the sources suggests that there are differences in detail, although probably not in substance.
16 | #' @source Marshall R M (1991) Mapping disease and mortality rates using Empirical Bayes Estimators, Applied Statistics, 40, 283--294; Bailey T, Gatrell A (1995) Interactive Spatial Data Analysis, Harlow: Longman --- INFOMAP data set used with permission.
17 | #' @docType data
18 | #' @keywords datasets sp
19 | #'
20 | #' @examples
21 | #' if (requireNamespace("sf", quietly = TRUE)) {
22 | #' auckland <- sf::st_read(system.file("shapes/auckland.gpkg", package="spData")[1])
23 | #' plot(sf::st_geometry(auckland))
24 | #' if (requireNamespace("spdep", quietly = TRUE)) {
25 | #' auckland.nb <- spdep::poly2nb(auckland)
26 | #' }
27 | #' }
28 | #'
29 |
30 | "auckland"
31 |
--------------------------------------------------------------------------------
/R/baltimore.R:
--------------------------------------------------------------------------------
1 | #' @name baltimore
2 | #' @aliases baltimore
3 | #' @title House sales prices, Baltimore, MD 1978
4 | #'
5 | #' @description House sales price and characteristics for a spatial hedonic regression, Baltimore, MD 1978. X,Y on Maryland grid, projection type unknown.
6 | #'
7 | #' @format A data frame with 211 observations on the following 17 variables.
8 | #' \itemize{
9 | #' \item{STATION: a numeric vector}
10 | #' \item{PRICE: a numeric vector}
11 | #' \item{NROOM: a numeric vector}
12 | #' \item{DWELL: a numeric vector}
13 | #' \item{NBATH: a numeric vector}
14 | #' \item{PATIO: a numeric vector}
15 | #' \item{FIREPL: a numeric vector}
16 | #' \item{AC: a numeric vector}
17 | #' \item{BMENT: a numeric vector}
18 | #' \item{NSTOR: a numeric vector}
19 | #' \item{GAR: a numeric vector}
20 | #' \item{AGE: a numeric vector}
21 | #' \item{CITCOU: a numeric vector}
22 | #' \item{LOTSZ: a numeric vector}
23 | #' \item{SQFT: a numeric vector}
24 | #' \item{X: a numeric vector}
25 | #' \item{Y: a numeric vector}
26 | #' }
27 | #'
28 | #' @source Prepared by Luc Anselin. Original data made available by Robin Dubin, Weatherhead School of Management, Case Western Research University, Cleveland, OH. http://sal.agecon.uiuc.edu/datasets/baltimore.zip
29 | #' @references Dubin, Robin A. (1992). Spatial autocorrelation and neighborhood quality. Regional Science and Urban Economics 22(3), 433-452.
30 | #' @docType data
31 | #' @keywords datasets sf
32 | #'
33 | #' @examples
34 | #' data(baltimore)
35 | #' str(baltimore)
36 | #'
37 | #' if (requireNamespace("sf", quietly = TRUE)) {
38 | #' library(sf)
39 | #' baltimore_sf <- baltimore %>% st_as_sf(., coords = c("X","Y"))
40 | #' plot(baltimore_sf["PRICE"])
41 | #' }
42 | "baltimore"
43 |
--------------------------------------------------------------------------------
/R/boston.R:
--------------------------------------------------------------------------------
1 | #' @name boston
2 | #' @aliases boston boston.c boston.soi boston.utm
3 | #' @title Corrected Boston Housing Data
4 | #'
5 | #' @description The \code{boston.c} data frame has 506 rows and 20 columns. It contains the Harrison and Rubinfeld (1978) data corrected for a few minor errors and augmented with the latitude and longitude of the observations. Gilley and Pace also point out that MEDV is censored, in that median values at or over USD 50,000 are set to USD 50,000. The original data set without the corrections is also included in package \code{mlbench} as \code{BostonHousing}. In addition, a matrix of tract point coordinates projected to UTM zone 19 is included as \code{boston.utm}, and a sphere of influence neighbours list as \code{boston.soi}.
6 | #'
7 | #' @format This data frame contains the following columns:
8 | #' \itemize{
9 | #' \item{TOWN: a factor with levels given by town names}
10 | #' \item{TOWNNO: a numeric vector corresponding to TOWN}
11 | #' \item{TRACT: a numeric vector of tract ID numbers}
12 | #' \item{LON: a numeric vector of tract point longitudes in decimal degrees}
13 | #' \item{LAT: a numeric vector of tract point latitudes in decimal degrees}
14 | #' \item{MEDV: a numeric vector of median values of owner-occupied housing
15 | #' in USD 1000}
16 | #' \item{CMEDV: a numeric vector of corrected median values of
17 | #' owner-occupied housing in USD 1000}
18 | #' \item{CRIM: a numeric vector of per capita crime}
19 | #' \item{ZN: a numeric vector of proportions of residential land zoned
20 | #' for lots over 25000 sq. ft per town (constant for all Boston tracts)}
21 | #' \item{INDUS: a numeric vector of proportions of non-retail business
22 | #' acres per town (constant for all Boston tracts)}
23 | #' \item{CHAS: a factor with levels 1 if tract borders Charles River;
24 | #' 0 otherwise}
25 | #' \item{NOX: a numeric vector of nitric oxides concentration (parts per
26 | #' 10 million) per town}
27 | #' \item{RM: a numeric vector of average numbers of rooms per dwelling}
28 | #' \item{AGE: a numeric vector of proportions of owner-occupied units
29 | #' built prior to 1940}
30 | #' \item{DIS: a numeric vector of weighted distances to five Boston
31 | #' employment centres}
32 | #' \item{RAD: a numeric vector of an index of accessibility to radial
33 | #' highways per town (constant for all Boston tracts)}
34 | #' \item{TAX: a numeric vector full-value property-tax rate per USD
35 | #' 10,000 per town (constant for all Boston tracts)}
36 | #' \item{PTRATIO: a numeric vector of pupil-teacher ratios per town
37 | #' (constant for all Boston tracts)}
38 | #' \item{B: a numeric vector of \code{1000*(Bk - 0.63)^2} where Bk is the
39 | #' proportion of blacks}
40 | #' \item{LSTAT: a numeric vector of percentage values of lower status
41 | #' population}
42 | #' }
43 | #' @note Details of the creation of the tract GPKG file: tract boundaries for 1990 (formerly at: http://www.census.gov/geo/cob/bdy/tr/tr90shp/tr25_d90_shp.zip, counties in the BOSTON SMSA http://www.census.gov/population/metro/files/lists/historical/63mfips.txt); tract conversion table 1980/1970 (formerly at : https://www.icpsr.umich.edu/icpsrweb/ICPSR/studies/7913?q=07913&permit[0]=AVAILABLE, http://www.icpsr.umich.edu/cgi-bin/bob/zipcart2?path=ICPSR&study=7913&bundle=all&ds=1&dups=yes). The shapefile contains corrections and extra variables (tract 3592 is corrected to 3593; the extra columns are:
44 | #' \itemize{
45 | #' \item{units: number of single family houses}
46 | #' \item{cu5k: count of units under USD 5,000}
47 | #' \item{c5_7_5: counts USD 5,000 to 7,500}
48 | #' \item{C*_*: interval counts}
49 | #' \item{co50k: count of units over USD 50,000}
50 | #' \item{median: recomputed median values}
51 | #' \item{BB: recomputed black population proportion}
52 | #' \item{censored: whether censored or not}
53 | #' \item{NOXID: NOX model zone ID}
54 | #' \item{POP: tract population}
55 | #' }
56 | #'
57 | #' @source Previously available from http://lib.stat.cmu.edu/datasets/boston_corrected.txt
58 | #' @references
59 | #' Harrison, David, and Daniel L. Rubinfeld, Hedonic Housing Prices and the Demand for Clean Air, \emph{Journal of Environmental Economics and Management}, Volume 5, (1978), 81-102. Original data.
60 | #'
61 | #' Gilley, O.W., and R. Kelley Pace, On the Harrison and Rubinfeld Data, \emph{Journal of Environmental Economics and Management}, 31 (1996),403-405. Provided corrections and examined censoring.
62 | #'
63 | #' Pace, R. Kelley, and O.W. Gilley, Using the Spatial Configuration of the Data to Improve Estimation, \emph{Journal of the Real Estate Finance and Economics}, 14 (1997), 333-340.
64 | #'
65 | #' Bivand, Roger. Revisiting the Boston data set - Changing the units of observation affects estimated willingness to pay for clean air. REGION, v. 4, n. 1, p. 109-127, 2017. \url{https://openjournals.wu.ac.at/ojs/index.php/region/article/view/107}.
66 | #'
67 | #' @docType data
68 | #' @keywords datasets spdep
69 | #'
70 | #' @examples
71 | #' if (requireNamespace("spdep", quietly = TRUE)) {
72 | #' data(boston)
73 | #' hr0 <- lm(log(MEDV) ~ CRIM + ZN + INDUS + CHAS + I(NOX^2) + I(RM^2) +
74 | #' AGE + log(DIS) + log(RAD) + TAX + PTRATIO + B + log(LSTAT), data = boston.c)
75 | #' summary(hr0)
76 | #' logLik(hr0)
77 | #' gp0 <- lm(log(CMEDV) ~ CRIM + ZN + INDUS + CHAS + I(NOX^2) + I(RM^2) +
78 | #' AGE + log(DIS) + log(RAD) + TAX + PTRATIO + B + log(LSTAT), data = boston.c)
79 | #' summary(gp0)
80 | #' logLik(gp0)
81 | #' spdep::lm.morantest(hr0, spdep::nb2listw(boston.soi))
82 | #' }
83 | #' if (requireNamespace("sf", quietly = TRUE)) {
84 | #' boston.tr <- sf::st_read(system.file("shapes/boston_tracts.gpkg",
85 | #' package="spData")[1])
86 | #' if (requireNamespace("spdep", quietly = TRUE)) {
87 | #' boston_nb <- spdep::poly2nb(boston.tr)
88 | #' }
89 | #' }
90 | #'
91 | NULL
92 |
--------------------------------------------------------------------------------
/R/coffee_data.R:
--------------------------------------------------------------------------------
1 | #' @name coffee_data
2 | #' @title World coffee production data
3 | #'
4 | #' @description A tiny dataset containing estimates of global coffee in thousands of 60 kg bags produced by country.
5 | #' Purpose: teaching **not** research.
6 | #'
7 | #' @format A data frame (tibble) with 58 for the following 12 variables:
8 | #' \itemize{
9 | #' \item{name_long: name of country or coffee variety}
10 | #' \item{coffee_production_2016: production in 2016}
11 | #' \item{coffee_production_2017: production in 2017}
12 | #' }
13 | #'
14 | #' @details The examples section shows how this can be joined with spatial data to create a simple map.
15 | #' @source The International Coffee Organization (ICO). See http://www.ico.org/ and
16 | #' http://www.ico.org/prices/m1-exports.pdf
17 | #' @docType data
18 | #' @keywords datasets misc
19 | #' @examples
20 | #' head(coffee_data)
21 | #' \dontrun{
22 | #' if (requireNamespace("dplyr")) {
23 | #' library(dplyr)
24 | #' library(sf)
25 | #' # found by searching for "global coffee data"
26 | #' u = "http://www.ico.org/prices/m1-exports.pdf"
27 | #' download.file(u, "data.pdf", mode = "wb")
28 | #' if (requireNamespace("pdftables")) { # requires api key
29 | #' pdftables::convert_pdf(input_file = "data.pdf", output_file = "coffee-data-messy.csv")
30 | #' d = read_csv("coffee-data-messy.csv")
31 | #' file.remove("coffee-data-messy.csv")
32 | #' file.remove("data.pdf")
33 | #' coffee_data = slice(d, -c(1:9)) %>%
34 | #' select(name_long = 1, coffee_production_2016 = 2, coffee_production_2017 = 3) %>%
35 | #' filter(!is.na(coffee_production_2016)) %>%
36 | #' mutate_at(2:3, str_replace, " ", "") %>%
37 | #' mutate_at(2:3, as.integer)
38 | #' world_coffee = left_join(world, coffee_data)
39 | #' plot(world_coffee[c("coffee_production_2016", "coffee_production_2017")])
40 | #' b = c(0, 500, 1000, 2000, 3000)
41 | #' library(tmap)
42 | #' tm_shape(world_coffee) +
43 | #' tm_fill("coffee_production_2017", title = "Thousand 60kg bags", breaks = b,
44 | #' textNA = "No data", colorNA = NULL)
45 | #' tmap_mode("view") # for an interactive version
46 | #' }}
47 | #' }
48 | "coffee_data"
49 |
--------------------------------------------------------------------------------
/R/columbus.R:
--------------------------------------------------------------------------------
1 | #' @name columbus
2 | #' @aliases columbus col.gal.nb coords polys bbs
3 | #' @title Columbus OH spatial analysis data set
4 | #'
5 | #' @description The \code{columbus} data frame has 49 rows and 22 columns. Unit of analysis: 49 neighbourhoods in Columbus, OH, 1980 data. In addition the data set includes a \code{polylist} object \code{polys} with the boundaries of the neighbourhoods, a matrix of polygon centroids \code{coords}, and \code{col.gal.nb}, the neighbours list from an original GAL-format file. The matrix \code{bbs} is DEPRECATED, but retained for other packages using this data set.
6 | #'
7 | #' @format This data frame contains the following columns:
8 | #' \itemize{
9 | #' \item{AREA: computed by ArcView}
10 | #' \item{PERIMETER: computed by ArcView}
11 | #' \item{COLUMBUS_: internal polygon ID (ignore)}
12 | #' \item{COLUMBUS_I: another internal polygon ID (ignore)}
13 | #' \item{POLYID: yet another polygon ID}
14 | #' \item{NEIG: neighborhood id value (1-49);
15 | #' conforms to id value used in Spatial Econometrics book.}
16 | #' \item{HOVAL: housing value (in 1,000 USD)}
17 | #' \item{INC: household income (in 1,000 USD)}
18 | #' \item{CRIME: residential burglaries and vehicle thefts per thousand
19 | #' households in the neighborhood}
20 | #' \item{OPEN: open space in neighborhood}
21 | #' \item{PLUMB: percentage housing units without plumbing}
22 | #' \item{DISCBD: distance to CBD}
23 | #' \item{X: x coordinate (in arbitrary digitizing units, not polygon coordinates)}
24 | #' \item{Y: y coordinate (in arbitrary digitizing units, not polygon coordinates)}
25 | #' \item{NSA: north-south dummy (North=1)}
26 | #' \item{NSB: north-south dummy (North=1)}
27 | #' \item{EW: east-west dummy (East=1)}
28 | #' \item{CP: core-periphery dummy (Core=1)}
29 | #' \item{THOUS: constant=1,000}
30 | #' \item{NEIGNO: NEIG+1,000, alternative neighborhood id value}
31 | #' }
32 | #' @details The row names of \code{columbus} and the \code{region.id} attribute of \code{polys} are set to \code{columbus$NEIGNO}.
33 | #' @source Anselin, Luc. 1988. Spatial econometrics: methods and models. Dordrecht: Kluwer Academic, Table 12.1 p. 189.
34 | #' @note All source data files prepared by Luc Anselin, Spatial Analysis Laboratory, Department of Agricultural and Consumer Economics, University of Illinois, Urbana-Champaign, http://sal.agecon.uiuc.edu/datasets/columbus.zip.
35 | #' @docType data
36 | #' @keywords datasets sp spdep
37 | #'
38 | #' @examples
39 | #' if (requireNamespace("sf", quietly = TRUE)) {
40 | #' columbus <- sf::st_read(system.file("shapes/columbus.gpkg", package="spData")[1])
41 | #' plot(sf::st_geometry(columbus))
42 | #' }
43 | #'
44 | #' if (requireNamespace("spdep", quietly = TRUE)) {
45 | #' library(spdep)
46 | #' col.gal.nb <- read.gal(system.file("weights/columbus.gal", package="spData")[1])
47 | #' }
48 | "columbus"
49 |
--------------------------------------------------------------------------------
/R/congruent.R:
--------------------------------------------------------------------------------
1 | #' @name congruent
2 | #' @aliases incongruent aggregating_zones
3 | #' @title Datasets to illustrate the concept of spatial congruence
4 | #'
5 | #' @description Sample of old (incongruent) and new (congruent) administrative zones
6 | #' from UK statistical agencies
7 | #'
8 | #' @format
9 | #' Simple feature geographic data in a projected CRS (OSGB) with random values assigned
10 | #' for teaching purposes.
11 | #'
12 | #' @source \url{https://en.wikipedia.org/wiki/ONS_coding_system}
13 | #' @docType data
14 | #' @keywords datasets sf
15 | #'
16 | #' @examples
17 | #' if(requireNamespace("sf", quietly = TRUE)) {
18 | #' library(sf)
19 | #' plot(aggregating_zones$geometry, lwd = 5)
20 | #' plot(congruent$geometry, add = TRUE, border = "green", lwd = 2)
21 | #' plot(incongruent$geometry, add = TRUE, border = "blue", col = NA)
22 | #' rbind(congruent, incongruent)
23 | #' }
24 | #' # Code used to download the data:
25 | #' \dontrun{
26 | #' #devtools::install_github("robinlovelace/ukboundaries")
27 | #' library(sf)
28 | #' library(tmap)
29 | #' library(dplyr)
30 | #' #library(ukboundaries)
31 | #' sel = grepl("003|004", msoa2011_lds$geo_label)
32 | #' aggregating_zones = st_transform(msoa2011_lds[sel, ], 27700)
33 | #' # find lsoas in the aggregating_zones
34 | #' lsoa_touching = st_transform(lsoa2011_lds, 27700)[aggregating_zones, ]
35 | #' lsoa_cents = st_centroid(lsoa_touching)
36 | #' lsoa_cents = lsoa_cents[aggregating_zones, ]
37 | #' sel = lsoa_touching$geo_code %in% lsoa_cents$geo_code
38 | #' # same for ed zones
39 | #' ed_touching = st_transform(ed1981, 27700)[aggregating_zones, ]
40 | #' ed_cents = st_centroid(ed_touching)
41 | #' ed_cents = ed_cents[aggregating_zones, ]
42 | #' incongruent_agg_ed = ed_touching[ed_cents, ]
43 | #' set.seed(2017)
44 | #' incongruent_agg_ed$value = rnorm(nrow(incongruent_agg_ed), mean = 5)
45 | #' congruent = aggregate(incongruent_agg_ed["value"], lsoa_touching[sel, ], mean)
46 | #' congruent$level = "Congruent"
47 | #' congruent = congruent[c("level", "value")]
48 | #' incongruent_cents = st_centroid(incongruent_agg_ed)
49 | #' aggregating_value = st_join(incongruent_cents, congruent)$value.y
50 | #' incongruent_agg = aggregate(incongruent_agg_ed["value"], list(aggregating_value), FUN = mean)
51 | #' incongruent_agg$level = "Incongruent"
52 | #' incongruent = incongruent_agg[c("level", "value")]
53 | #' summary(st_geometry_type(congruent))
54 | #' summary(st_geometry_type(incongruent))
55 | #' incongruent = st_cast(incongruent, "MULTIPOLYGON")
56 | #' summary(st_geometry_type(incongruent))
57 | #' summary(st_geometry_type(aggregating_zones))
58 | #' devtools::use_data(congruent, overwrite = TRUE)
59 | #' devtools::use_data(incongruent, overwrite = TRUE)
60 | #' devtools::use_data(aggregating_zones, overwrite = TRUE)
61 | #' }
62 | "congruent"
63 |
--------------------------------------------------------------------------------
/R/cycle_hire.R:
--------------------------------------------------------------------------------
1 | #' @name cycle_hire
2 | #' @aliases cycle_hire
3 | #' @title Cycle hire points in London
4 | #'
5 | #' @description
6 | #'
7 | #' Points
8 | #' representing cycle hire points accross London.
9 | #'
10 | #' @format FORMAT:
11 | #' \itemize{
12 | #' \item{id: Id of the hire point}
13 | #' \item{name: Name of the point}
14 | #' \item{area: Area they are in}
15 | #' \item{nbikes: The number of bikes currently parked there}
16 | #' \item{nempty: The number of empty places}
17 | #' \item{geometry: sfc_POINT}
18 | #' }
19 | #'
20 | #' @source \url{https://www.data.gov.uk/}
21 | #' @docType data
22 | #' @keywords datasets sf
23 | #'
24 | #' @examples
25 | #' if (requireNamespace("sf", quietly = TRUE)) {
26 | #' library(sf)
27 | #' data(cycle_hire)
28 | #' # or
29 | #' cycle_hire <- st_read(system.file("shapes/cycle_hire.geojson", package="spData"))
30 | #'
31 | #' plot(cycle_hire)
32 | #' }
33 | #'
34 | #' \dontrun{
35 | #' # Download the data
36 | #' cycle_hire = readr::read_csv("http://cyclehireapp.com/cyclehirelive/cyclehire.csv",
37 | #' col_names = FALSE, skip = TRUE)
38 | #' cycle_hire = cycle_hire[c_names]
39 | #' c_names = c("id", "name", "area", "lat", "lon", "nbikes", "nempty")
40 | #' cycle_hire = st_sf(cycle_hire, st_multipoint(c_names[c("lon", "lat")]))
41 | #' }
42 | "cycle_hire"
43 |
--------------------------------------------------------------------------------
/R/cycle_hire_osm.R:
--------------------------------------------------------------------------------
1 | #' @name cycle_hire_osm
2 | #' @aliases cycle_hire_osm
3 | #' @title Cycle hire points in London from OSM
4 | #'
5 | #' @description Dataset downloaded using the osmdata package
6 | #' representing cycle hire points accross London.
7 | #'
8 | #' @format
9 | #' \itemize{
10 | #' \item{osm_id: The OSM ID}
11 | #' \item{name: The name of the cycle point}
12 | #' \item{capacity: How many bikes it can take}
13 | #' \item{cyclestreets_id: The ID linked to cyclestreets' photomap}
14 | #' \item{description: Additional description of points}
15 | #' \item{geometry: sfc_POINT}
16 | #' }
17 | #'
18 | #' @seealso
19 | #' See the osmdata package: https://cran.r-project.org/package=osmdata
20 | #'
21 | #' @source \url{https://www.openstreetmap.org}
22 | #' @docType data
23 | #' @keywords datasets sf
24 | #'
25 | #' @examples
26 | #' if (requireNamespace("sf", quietly = TRUE)) {
27 | #' library(sf)
28 | #' data(cycle_hire_osm)
29 | #' # or
30 | #' cycle_hire_osm <- st_read(system.file("shapes/cycle_hire_osm.geojson", package="spData"))
31 | #'
32 | #' plot(cycle_hire_osm)
33 | #' }
34 | #'
35 | #' # Code used to download the data:
36 | #' \dontrun{
37 | #' library(osmdata)
38 | #' library(dplyr)
39 | #' library(sf)
40 | #' q = add_osm_feature(opq = opq("London"), key = "network", value = "tfl_cycle_hire")
41 | #' lnd_cycle_hire = osmdata_sf(q)
42 | #' cycle_hire_osm = lnd_cycle_hire$osm_points
43 | #' nrow(cycle_hire_osm)
44 | #' plot(cycle_hire_osm)
45 | #' cycle_hire_osm = dplyr::select(cycle_hire_osm, osm_id, name, capacity,
46 | #' cyclestreets_id, description) %>%
47 | #' mutate(capacity = as.numeric(capacity))
48 | #' names(cycle_hire_osm)
49 | #' nrow(cycle_hire_osm)
50 | #' }
51 | "cycle_hire_osm"
52 |
--------------------------------------------------------------------------------
/R/depmunic.R:
--------------------------------------------------------------------------------
1 | #' @name depmunic
2 | #' @aliases depmunic
3 | #' @title Municipality departments of Athens (Sf)
4 | #'
5 | #' @description The geographic boundaries of departments (sf) of the municipality of Athens. This is accompanied by various characteristics in these areas.
6 | #'
7 | #' @format An sf object of 7 polygons with the following 7 variables.
8 | #' \itemize{
9 | #' \item{num_dep: An unique identifier for each municipality department.}
10 | #' \item{airbnb: The number of airbnb properties in 2017}
11 | #' \item{museums: The number of museums}
12 | #' \item{population: The population recorded in census at 2011.}
13 | #' \item{pop_rest: The number of citizens that the origin is a non european country.}
14 | #' \item{greensp: The area of green spaces (unit: square meters).}
15 | #' \item{area: The area of the polygon (unit: square kilometers). }
16 | #' }
17 | #'
18 | #' @docType data
19 | #' @keywords datasets sf
20 | #' @seealso properties
21 | #'
22 | #' @examples
23 | #' if (requireNamespace("sf", quietly = TRUE)) {
24 | #' library(sf)
25 | #' data(depmunic)
26 | #'
27 | #' depmunic$foreigners <- 100*depmunic$pop_rest/depmunic$population
28 | #' plot(depmunic["foreigners"], key.pos=1)
29 | #' }
30 | "depmunic"
31 |
--------------------------------------------------------------------------------
/R/eire.R:
--------------------------------------------------------------------------------
1 | #' @name eire
2 | #' @aliases eire eire.df eire.polys.utm eire.coords.utm eire.nb
3 | #' @title Eire data sets
4 | #'
5 | #' @description The Eire data set has been converted to shapefile format and placed in the etc/shapes directory. The initial data objects are now stored as a SpatialPolygonsDataFrame object, from which the contiguity neighbour list is recreated. For purposes of record, the original data set is retained.
6 | #' The \code{eire.df} data frame has 26 rows and 9 columns. In addition, polygons of the 26 counties are provided as a multipart polylist in eire.polys.utm (coordinates in km, projection UTM zone 30). Their centroids are in eire.coords.utm. The original Cliff and Ord binary contiguities are in eire.nb.
7 | #'
8 | #' @format This data frame contains the following columns:
9 | #' \itemize{
10 | #' \item{A: Percentage of sample with blood group A}
11 | #' \item{towns: Towns/unit area}
12 | #' \item{pale: Beyond the Pale 0, within the Pale 1}
13 | #' \item{size: number of blood type samples}
14 | #' \item{ROADACC: arterial road network accessibility in 1961}
15 | #' \item{OWNCONS: percentage in value terms of gross agricultural output of each county consumed by itself}
16 | #' \item{POPCHG: 1961 population as percentage of 1926}
17 | #' \item{RETSALE: value of retail sales British Pound000}
18 | #' \item{INCOME: total personal income British Pound000}
19 | #' \item{names: County names}
20 | #' }
21 | #'
22 | #' @source Upton and Fingleton 1985, - Bailey and Gatrell 1995, ch. 1 for blood group data, Cliff and Ord (1973), p. 107 for remaining variables (also after O'Sullivan, 1968). Polygon borders and Irish data sourced from Michael Tiefelsdorf's SPSS Saddlepoint bundle, originally hosted at: http://geog-www.sbs.ohio-state.edu/faculty/tiefelsdorf/GeoStat.htm.
23 | #' @docType data
24 | #' @keywords datasets sp spdep
25 | #'
26 | #' @examples
27 | #' \donttest{
28 | #' library(spdep)
29 | #' eire <- sf::st_read(system.file("shapes/eire.gpkg", package="spData")[1])
30 | #' eire.nb <- poly2nb(eire)
31 | #'
32 | #' # Eire physical anthropology blood group data
33 | #' summary(eire$A)
34 | #' brks <- round(fivenum(eire$A), digits=2)
35 | #' cols <- rev(heat.colors(4))
36 | #' plot(eire, col=cols[findInterval(eire$A, brks, all.inside=TRUE)])
37 | #' title(main="Percentage with blood group A in Eire")
38 | #' legend(x=c(-50, 70), y=c(6120, 6050),
39 | #' c("under 27.91", "27.91 - 29.26", "29.26 - 31.02", "over 31.02"),
40 | #' fill=cols, bty="n")
41 | #'
42 | #' plot(st_geometry(eire))
43 | #' plot(eire.nb, st_geometry(eire), add=TRUE)
44 | #'
45 | #' lA <- lag.listw(nb2listw(eire.nb), eire$A)
46 | #' summary(lA)
47 | #' moran.test(eire$A, nb2listw(eire.nb))
48 | #' geary.test(eire$A, nb2listw(eire.nb))
49 | #' cor(lA, eire$A)
50 | #' moran.plot(eire$A, nb2listw(eire.nb), labels=eire$names)
51 | #' A.lm <- lm(A ~ towns + pale, data=eire)
52 | #' summary(A.lm)
53 | #' res <- residuals(A.lm)
54 | #' brks <- c(min(res),-2,-1,0,1,2,max(res))
55 | #' cols <- rev(cm.colors(6))
56 | #'
57 | #' plot(eire, col=cols[findInterval(res, brks, all.inside=TRUE)])
58 | #' title(main="Regression residuals")
59 | #' legend(x=c(-50, 70), y=c(6120, 6050),
60 | #' legend=c("under -2", "-2 - -1", "-1 - 0", "0 - 1", "1 - 2", "over 2"),
61 | #' fill=cols, bty="n")
62 | #'
63 | #' lm.morantest(A.lm, nb2listw(eire.nb))
64 | #' lm.morantest.sad(A.lm, nb2listw(eire.nb))
65 | #' lm.LMtests(A.lm, nb2listw(eire.nb), test="LMerr")
66 | #'
67 | #' # Eire agricultural data
68 | #' brks <- round(fivenum(eire$OWNCONS), digits=2)
69 | #' cols <- grey(4:1/5)
70 | #' plot(eire, col=cols[findInterval(eire$OWNCONS, brks, all.inside=TRUE)])
71 | #' title(main="Percentage own consumption of agricultural produce")
72 | #' legend(x=c(-50, 70), y=c(6120, 6050),
73 | #' legend=c("under 9", "9 - 12.2", "12.2 - 19", "over 19"), fill=cols, bty="n")
74 | #'
75 | #' moran.plot(eire$OWNCONS, nb2listw(eire.nb))
76 | #' moran.test(eire$OWNCONS, nb2listw(eire.nb))
77 | #' e.lm <- lm(OWNCONS ~ ROADACC, data=eire)
78 | #' res <- residuals(e.lm)
79 | #' brks <- c(min(res),-2,-1,0,1,2,max(res))
80 | #' cols <- rev(cm.colors(6))
81 | #' plot(eire, col=cols[findInterval(res, brks, all.inside=TRUE)])
82 | #' title(main="Regression residuals")
83 | #' legend(x=c(-50, 70), y=c(6120, 6050),
84 | #' legend=c("under -2", "-2 - -1", "-1 - 0", "0 - 1", "1 - 2", "over 2"),
85 | #' fill=cm.colors(6), bty="n")
86 | #'
87 | #' lm.morantest(e.lm, nb2listw(eire.nb))
88 | #' lm.morantest.sad(e.lm, nb2listw(eire.nb))
89 | #' lm.LMtests(e.lm, nb2listw(eire.nb), test="LMerr")
90 | #' print(localmoran.sad(e.lm, eire.nb, select=seq(along=eire.nb)))
91 | #' }
92 | NULL
93 |
--------------------------------------------------------------------------------
/R/elect80.R:
--------------------------------------------------------------------------------
1 | #' @name elect80
2 | #' @aliases elect80 elect80_lw k4 dll e80_queen
3 | #' @title 1980 Presidential election results
4 | #'
5 | #' @description A data set for 1980 Presidential election results covering 3,107 US counties using geographical coordinates. In addition, three spatial neighbour objects, \code{k4} not using Great Circle distances, \code{dll} using Great Circle distances, and \code{e80_queen} of Queen contiguities for equivalent County polygons taken from file \code{co1980p020.tar.gz} on the USGS National Atlas site, and a spatial weights object imported from \code{elect.ford} - a 4-nearest neighbour non-GC row-standardised object, but with coercion to symmetry.
6 | #'
7 | #' @format
8 | #' A SpatialPointsDataFrame with 3107 observations on the following 7 variables.
9 | #' \itemize{
10 | #' \item{FIPS: a factor of county FIPS codes}
11 | #' \item{long: a numeric vector of longitude values}
12 | #' \item{lat: a numeric vector of latitude values}
13 | #' \item{pc_turnout: Votes cast as proportion of population over age 19 eligible to vote}
14 | #' \item{pc_college: Population with college degrees as proportion of population over age 19 eligible to vote}
15 | #' \item{pc_homeownership: Homeownership as proportion of population over age 19 eligible to vote}
16 | #' \item{pc_income: Income per capita of population over age 19 eligible to vote}
17 | #' }
18 | #'
19 | #' @source Pace, R. Kelley and Ronald Barry. 1997. "Quick Computation of Spatial Autoregressive Estimators", in Geographical Analysis; sourced from the data folder in the Spatial Econometrics Toolbox for Matlab, formerly available from http://www.spatial-econometrics.com/html/jplv7.zip, files \code{elect.dat} and \code{elect.ford} (with the final line dropped).
20 | #' @docType data
21 | #' @keywords datasets sp
22 | #' @importClassesFrom sp SpatialPointsDataFrame
23 | #'
24 | #' @examples
25 | #' if (requireNamespace("sp", quietly = TRUE)) {
26 | #' library(sp)
27 | #' data(elect80)
28 | #' summary(elect80)
29 | #' plot(elect80)
30 | #' }
31 | "elect80"
32 |
--------------------------------------------------------------------------------
/R/elev.R:
--------------------------------------------------------------------------------
1 | #' @name elev.tif
2 | #' @title Artificial elevation raster data set
3 | #'
4 | #' @description The raster data represents elevation in meters and uses WGS84 as
5 | #' a coordinate reference system.
6 | #' @docType data
7 | #' @keywords datasets raster
8 | #'
9 | #' @examples
10 | #' system.file("raster/elev.tif", package = "spData")
11 | NULL
12 |
13 |
--------------------------------------------------------------------------------
/R/getisord.R:
--------------------------------------------------------------------------------
1 | #' @name getisord
2 | #' @aliases getisord go_x go_y go_xyz
3 | #' @title Getis-Ord remote sensing example data
4 | #'
5 | #' @description The \code{go_xyz} data frame has 256 rows and 3 columns. Vectors \code{go_x} and \code{go_y} are of length 16 and give the centres of the grid rows and columns, 30m apart. The data start from the bottom left, Getis and Ord start from the top left - so their 136th grid cell is our 120th.
6 | #'
7 | #' @format
8 | #' This data frame contains the following columns:
9 | #' \itemize{
10 | #' \item{x: grid eastings}
11 | #' \item{y: grid northings}
12 | #' \item{val: remote sensing values}
13 | #' }
14 | #'
15 | #' @source Getis, A. and Ord, J. K. 1996 Local spatial statistics: an overview. In P. Longley and M. Batty (eds) \emph{Spatial analysis: modelling in a GIS environment} (Cambridge: Geoinformation International), 266.
16 | #' @docType data
17 | #' @keywords datasets misc
18 | #'
19 | #' @examples
20 | #' data(getisord)
21 | #' image(go_x, go_y, t(matrix(go_xyz$val, nrow = 16, ncol=16, byrow = TRUE)), asp = 1)
22 | #' text(go_xyz$x, go_xyz$y, go_xyz$val, cex = 0.7)
23 | #' polygon(c(195, 225, 225, 195), c(195, 195, 225, 225), lwd = 2)
24 | #' title(main = "Getis-Ord 1996 remote sensing data")
25 | #'
26 | NULL
27 |
--------------------------------------------------------------------------------
/R/grain.R:
--------------------------------------------------------------------------------
1 | #' @name grain.tif
2 | #' @title Artificial raster dataset representing grain sizes
3 | #' @description The ratified raster dataset represents grain sizes with the
4 | #' three classes clay, silt and sand, and WGS84 as a coordinate reference
5 | #' system.
6 | #' @docType data
7 | #' @keywords datasets raster
8 | #'
9 | #' @examples
10 | #' system.file("raster/grain.tif", package = "spData")
11 | NULL
12 |
--------------------------------------------------------------------------------
/R/hawaii.R:
--------------------------------------------------------------------------------
1 | #' @name hawaii
2 | #' @title Hawaii multipolygon
3 | #'
4 | #' @description The object loaded is a \code{sf} object containing the state of
5 | #' Hawaii from the US Census Bureau
6 | #' with a few variables from American Community Survey (ACS)
7 | #'
8 | #' @format Formal class 'sf' [package "sf"]; the data contains a data.frame with 1 obs. of 7 variables:
9 | #' \itemize{
10 | #' \item{GEOID: character vector of geographic identifiers}
11 | #' \item{NAME: character vector of state names}
12 | #' \item{REGION: character vector of region names}
13 | #' \item{AREA: area in square kilometers of units class}
14 | #' \item{total_pop_10: numerical vector of total population in 2010}
15 | #' \item{total_pop_15: numerical vector of total population in 2015}
16 | #' \item{geometry: sfc_MULTIPOLYGON}
17 | #' }
18 | #' The object is in projected coordinates using Hawaii Albers Equal Area Conic (ESRI:102007).
19 | #'
20 | #' @seealso
21 | #' See the tigris package: https://cran.r-project.org/package=tigris
22 | #'
23 | #' @source \url{https://www.census.gov/geographies/mapping-files/time-series/geo/tiger-line-file.html}
24 | #' @docType data
25 | #' @keywords datasets sf
26 | #' @examples
27 | #' if (requireNamespace("sf", quietly = TRUE)) {
28 | #' library(sf)
29 | #' data(hawaii)
30 | #'
31 | #' plot(hawaii["total_pop_15"])
32 | #' }
33 | "hawaii"
34 |
--------------------------------------------------------------------------------
/R/hopkins.R:
--------------------------------------------------------------------------------
1 | #' @name hopkins
2 | #' @aliases hopkins
3 | #' @title Hopkins burnt savanna herb remains
4 | #'
5 | #' @description A 20m square is divided into 40 by 40 0.5m quadrats. Observations are in tens of grams of herb remains, 0 being from 0g to less than 10g, and so on. Analysis was mostly conducted using the interior 32 by 32 grid.
6 | #'
7 | #' @format num [1:40, 1:40] 0 0 0 0 0 0 0 0 0 1 ...
8 | #'
9 | #' @source Upton, G., Fingleton, B. 1985 Spatial data analysis by example: point pattern and quatitative data, Wiley, pp. 38--39.
10 | #' @references Hopkins, B., 1965 Observations on savanna burning in the Olokemeji Forest Reserve, Nigeria. Journal of Applied Ecology, 2, 367--381.
11 | #' @docType data
12 | #' @keywords datasets misc
13 | #'
14 | #' @examples
15 | #' data(hopkins)
16 | #' image(1:32, 1:32, hopkins[5:36,36:5], breaks=c(-0.5, 3.5, 20),
17 | #' col=c("white", "black"))
18 | "hopkins"
19 |
--------------------------------------------------------------------------------
/R/house.R:
--------------------------------------------------------------------------------
1 | #' @name house
2 | #' @aliases house LO_nb trMat
3 | #' @title Lucas county OH housing
4 | #'
5 | #' @description Data on 25,357 single family homes sold in Lucas County, Ohio, 1993-1998 from the county auditor, together with an \code{nb} neighbour object constructed as a sphere of influence graph from projected coordinates.
6 | #'
7 | #' @format Formal class 'SpatialPointsDataFrame' [package "sp"] with 5 slots. The data slot is a data frame with 25357 observations on the following 24 variables.
8 | #' \itemize{
9 | #' \item{price: a numeric vector}
10 | #' \item{yrbuilt: a numeric vector}
11 | #' \item{stories: a factor with levels \code{one} \code{bilevel} \code{multilvl} \code{one+half} \code{two} \code{two+half} \code{three}}
12 | #' \item{TLA: a numeric vector}
13 | #' \item{wall: a factor with levels \code{stucdrvt} \code{ccbtile} \code{metlvnyl} \code{brick} \code{stone} \code{wood} \code{partbrk}}
14 | #' \item{beds: a numeric vector}
15 | #' \item{baths: a numeric vector}
16 | #' \item{halfbaths: a numeric vector}
17 | #' \item{frontage: a numeric vector}
18 | #' \item{depth: a numeric vector}
19 | #' \item{garage: a factor with levels \code{no garage} \code{basement} \code{attached} \code{detached} \code{carport}}
20 | #' \item{garagesqft: a numeric vector}
21 | #' \item{rooms: a numeric vector}
22 | #' \item{lotsize: a numeric vector}
23 | #' \item{sdate: a numeric vector}
24 | #' \item{avalue: a numeric vector}
25 | #' \item{s1993: a numeric vector}
26 | #' \item{s1994: a numeric vector}
27 | #' \item{s1995: a numeric vector}
28 | #' \item{s1996: a numeric vector}
29 | #' \item{s1997: a numeric vector}
30 | #' \item{s1998: a numeric vector}
31 | #' \item{syear: a factor with levels \code{1993} \code{1994} \code{1995} \code{1996} \code{1997} \code{1998}}
32 | #' \item{age: a numeric vector}
33 | #' }
34 | #' Its projection is \code{CRS(+init=epsg:2834)}, the Ohio North State Plane.
35 | #'
36 | #' @source Dataset included in the Spatial Econometrics toolbox for Matlab, formerly available from http://www.spatial-econometrics.com/html/jplv7.zip.
37 | #' @docType data
38 | #' @keywords datasets sp
39 | #' @importClassesFrom sp SpatialPointsDataFrame
40 | #'
41 | #' @examples
42 | #' if (requireNamespace("sp", quietly = TRUE)) {
43 | #' library(sp)
44 | #' data(house)
45 | #' str(house)
46 | #' plot(house)
47 | #' }
48 | "house"
49 |
--------------------------------------------------------------------------------
/R/huddersfield.R:
--------------------------------------------------------------------------------
1 | #' @name huddersfield
2 | #' @aliases huddersfield
3 | #' @title Prevalence of respiratory symptoms
4 | #'
5 | #' @description Prevalence of respiratory symptoms in 71 school catchment areas in Huddersfield, Northern England
6 | #'
7 | #' @format A data frame with 71 observations on the following 2 variables.
8 | #' \itemize{
9 | #' \item{\code{cases}: Prevalence of at least mild conditions}
10 | #' \item{\code{total}: Number of questionnaires returned}
11 | #' }
12 | #'
13 | #' @source Martuzzi M, Elliott P (1996) Empirical Bayes estimation of small area prevalence of non-rare conditions, Statistics in Medicine 15, 1867--1873, pp. 1870--1871.
14 | #' @docType data
15 | #' @keywords datasets misc
16 | #'
17 | #' @examples
18 | #' data(huddersfield)
19 | #' str(huddersfield)
20 | "huddersfield"
21 |
--------------------------------------------------------------------------------
/R/jenks71.R:
--------------------------------------------------------------------------------
1 | #' @name jenks71
2 | #' @aliases jenks71
3 | #' @title Illinois 1959 county gross farm product value per acre
4 | #'
5 | #' @description Classic data set for the choice of class intervals for choropleth maps.
6 | #'
7 | #' @format A data frame with 102 observations on the following 2 variables.
8 | #' \itemize{
9 | #' \item{\code{jenks71}: a numeric vector: Per acre value of gross farm products in dollars by county for Illinois in #' 1959}
10 | #' \item{\code{area}: a numeric vector: county area in square miles}
11 | #' }
12 | #'
13 | #' @source Jenks, G. F., Caspall, F. C., 1971. "Error on choroplethic maps: definition, measurement, reduction". Annals, Association of American Geographers, 61 (2), 217--244
14 | #' @docType data
15 | #' @keywords datasets misc
16 | #'
17 | #' @examples
18 | #' data(jenks71)
19 | #' jenks71
20 | "jenks71"
21 |
--------------------------------------------------------------------------------
/R/lnd.R:
--------------------------------------------------------------------------------
1 | #' @name lnd
2 | #' @aliases lnd
3 | #' @title The boroughs of London
4 | #'
5 | #' @description Polygons representing large administrative zones in London
6 | #'
7 | #' @format
8 | #' \itemize{
9 | #' \item{NAME: Borough name}
10 | #' \item{GSS_CODE: Official code}
11 | #' \item{HECTARES: How many hectares}
12 | #' \item{NONLD_AREA: Area outside London}
13 | #' \item{ONS_INNER: Office for national statistics code}
14 | #' \item{SUB_2009: Empty column}
15 | #' \item{SUB_2006: Empty column}
16 | #' \item{geometry: sfc_MULTIPOLYGON}
17 | #' }
18 | #'
19 | #' @source \url{https://github.com/Robinlovelace/Creating-maps-in-R}
20 | #' @docType data
21 | #' @keywords datasets sf
22 | #'
23 | #' @examples
24 | #' if (requireNamespace("sf", quietly = TRUE)) {
25 | #' library(sf)
26 | #' data(lnd)
27 | #' summary(lnd)
28 | #' plot(st_geometry(lnd))
29 | #' }
30 | "lnd"
31 |
--------------------------------------------------------------------------------
/R/nc.sids.R:
--------------------------------------------------------------------------------
1 | #' @name nc.sids
2 | #' @aliases nc.sids ncCR85.nb ncCC89.nb sidspolys sidscents
3 | #' @title North Carolina SIDS data
4 | #'
5 | #' @description (Use \code{example(nc.sids)} to read the data set from shapefile, together with import of two different list of neighbours).
6 | #' The \code{nc.sids} data frame has 100 rows and 21 columns. It contains data given in Cressie (1991, pp. 386-9), Cressie and Read (1985) and Cressie and Chan (1989) on sudden infant deaths in North Carolina for 1974-78 and 1979-84. The data set also contains the neighbour list given by Cressie and Chan (1989) omitting self-neighbours (ncCC89.nb), and the neighbour list given by Cressie and Read (1985) for contiguities (ncCR85.nb). The data are ordered by county ID number, not alphabetically as in the source tables \code{sidspolys} is a "polylist" object of polygon boundaries, and \code{sidscents} is a matrix of their centroids.
7 | #'
8 | #' @format
9 | #' This data frame contains the following columns:
10 | #' \itemize{
11 | #' \item{SP_ID: SpatialPolygons ID}
12 | #' \item{CNTY_ID: county ID}
13 | #' \item{east: eastings, county seat, miles, local projection}
14 | #' \item{north: northings, county seat, miles, local projection}
15 | #' \item{L_id: Cressie and Read (1985) L index}
16 | #' \item{M_id: Cressie and Read (1985) M index}
17 | #' \item{names: County names}
18 | #' \item{AREA: County polygon areas in degree units}
19 | #' \item{PERIMETER: County polygon perimeters in degree units}
20 | #' \item{CNTY_: Internal county ID}
21 | #' \item{NAME: County names}
22 | #' \item{FIPS: County ID}
23 | #' \item{FIPSNO: County ID}
24 | #' \item{CRESS_ID: Cressie papers ID}
25 | #' \item{BIR74: births, 1974-78}
26 | #' \item{SID74: SID deaths, 1974-78}
27 | #' \item{NWBIR74: non-white births, 1974-78}
28 | #' \item{BIR79: births, 1979-84}
29 | #' \item{SID79: SID deaths, 1979-84}
30 | #' \item{NWBIR79: non-white births, 1979-84}
31 | #' }
32 | #'
33 | #' @source Cressie, N (1991), \emph{Statistics for spatial data}. New York: Wiley, pp. 386--389; Cressie, N, Chan NH (1989) Spatial modelling of regional variables. \emph{Journal of the American Statistical Association}, 84, 393--401; Cressie, N, Read, TRC (1985) Do sudden infant deaths come in clusters? \emph{Statistics and Decisions} Supplement Issue 2, 333--349; http://sal.agecon.uiuc.edu/datasets/sids.zip.
34 | #' @docType data
35 | #' @keywords datasets spdep
36 | #'
37 | #' @examples
38 | #' if (requireNamespace("sf", quietly = TRUE)) {
39 | #' if (requireNamespace("spdep", quietly = TRUE)) {
40 | #' library(spdep)
41 | #' nc.sids <- sf::st_read(system.file("shapes/sids.gpkg", package="spData")[1])
42 | #' row.names(nc.sids) <- as.character(nc.sids$FIPS)
43 | #' rn <- row.names(nc.sids)
44 | #' ncCC89_nb <- read.gal(system.file("weights/ncCC89.gal", package="spData")[1],
45 | #' region.id=rn)
46 | #' ncCR85_nb <- read.gal(system.file("weights/ncCR85.gal", package="spData")[1],
47 | #' region.id=rn)
48 | #'
49 | #' plot(sf::st_geometry(nc.sids), border="grey")
50 | #' plot(ncCR85_nb, sf::st_geometry(nc.sids), add=TRUE, col="blue")
51 | #' plot(sf::st_geometry(nc.sids), border="grey")
52 | #' plot(ncCC89_nb, sf::st_geometry(nc.sids), add=TRUE, col="blue")
53 | #' }
54 | #' }
55 | "nc.sids"
56 |
--------------------------------------------------------------------------------
/R/nydata.R:
--------------------------------------------------------------------------------
1 | #' @name nydata
2 | #' @aliases NY_data nydata listw_NY
3 | #' @title New York leukemia data
4 | #'
5 | #' @description New York leukemia data taken from the data sets supporting Waller and Gotway 2004 (the data should be loaded by running \code{example(NY_data)} to demonstrate spatial data import techniques)
6 | #'
7 | #' @format A data frame with 281 observations on the following 12 variables, and the binary coded spatial weights used in the source.
8 | #' \itemize{
9 | #' \item{AREANAME: name of census tract}
10 | #' \item{AREAKEY: unique FIPS code for each tract}
11 | #' \item{X: x-coordinate of tract centroid (in km)}
12 | #' \item{Y: y-coordinate of tract centroid (in km)}
13 | #' \item{POP8: population size (1980 U.S. Census)}
14 | #' \item{TRACTCAS: number of cases 1978-1982}
15 | #' \item{PROPCAS: proportion of cases per tract}
16 | #' \item{PCTOWNHOME: percentage of people in each tract owning their own home}
17 | #' \item{PCTAGE65P: percentage of people in each tract aged 65 or more}
18 | #' \item{Z: ransformed propoprtions}
19 | #' \item{AVGIDIST: average distance between centroid and TCE sites}
20 | #' \item{PEXPOSURE: "exposure potential": inverse distance between each census tract centroid and the nearest TCE site, IDIST, transformed via log(100*IDIST)}
21 | #' \item{Cases: as TRACTCAS with more digits}
22 | #' \item{Xm: X in metres}
23 | #' \item{Ym: Y in metres}
24 | #' \item{Xshift: feature offset}
25 | #' \item{Yshift: feature offset}
26 | #' }
27 | #'
28 | #' @details The examples section shows how the DBF files from the book website for Chapter 9 were converted into the \code{nydata} data frame and the \code{listw_NY} spatial weights list. The \code{shapes} directory includes the original version of the UTM18 census tract boundaries imported from BNA format (http://sedac.ciesin.columbia.edu/ftpsite/pub/census/usa/tiger/ny/bna_st/t8_36.zip) before the OGR/GDAL BNA driver was available. The \code{NY8_utm18} shapefile was constructed using a bna2mif converter and converted to shapefile format after adding data using \code{writeOGR}. The new file \code{NY8_bna_utm18.gpkg} has been constructed from the original BNA file, but read using the OGR BNA driver with GEOS support. The NY8 shapefile and GeoPackage NY8_utm18.gpkg include invalid polygons, but because the OGR BNA driver may have GEOS support (used here), the tract polygon objects in NY8_bna_utm18.gpkg are valid.
29 | #'
30 | #' @source http://www.sph.emory.edu/~lwaller/ch9index.htm
31 | #' @references Waller, L. and C. Gotway (2004) \emph{Applied Spatial Statistics for Public Health Data}. New York: John Wiley and Sons.
32 | #' @docType data
33 | #' @keywords datasets foreign spdep
34 | #'
35 | #' @examples
36 | #' ## NY leukemia
37 | #' \donttest{
38 | #' if (requireNamespace("sf", quietly = TRUE)) {
39 | #' library(foreign)
40 | #' nydata <- read.dbf(system.file("misc/nydata.dbf", package="spData")[1])
41 | #' nydata <- sf::st_as_sf(nydata, coords=c("X", "Y"), remove=FALSE)
42 | #' plot(sf::st_geometry(nydata))
43 | #'
44 | #' nyadjmat <- as.matrix(read.dbf(system.file("misc/nyadjwts.dbf",
45 | #' package="spData")[1])[-1])
46 | #' ID <- as.character(names(read.dbf(system.file("misc/nyadjwts.dbf",
47 | #' package="spData")[1]))[-1])
48 | #' identical(substring(ID, 2, 10), substring(as.character(nydata$AREAKEY), 2, 10))
49 | #'
50 | #' if (requireNamespace("sf", quietly = TRUE)) {
51 | #' library(spdep)
52 | #' listw_NY <- mat2listw(nyadjmat, as.character(nydata$AREAKEY), style="B")
53 | #' }
54 | #' }
55 | #' }
56 | "nydata"
57 |
--------------------------------------------------------------------------------
/R/nz.R:
--------------------------------------------------------------------------------
1 | #' @name nz
2 | #' @aliases new_zealand
3 | #' @title Regions in New Zealand
4 | #'
5 | #' @description
6 | #'
7 | #' Polygons representing the 16 regions of New Zealand (2018).
8 | #' See \url{https://en.wikipedia.org/wiki/Regions_of_New_Zealand} for a description of these regions
9 | #' and \url{https://www.stats.govt.nz} for information on the data source
10 | #'
11 | #' @format FORMAT:
12 | #' \itemize{
13 | #' \item{Name: Name}
14 | #' \item{Island: Island}
15 | #' \item{Land_area: Land area}
16 | #' \item{Population: Population}
17 | #' \item{Median_income: Median income (NZD)}
18 | #' \item{Sex_ratio: Sex ratio (male/female)}
19 | #' \item{geom: sfc_MULTIPOLYGON}
20 | #' }
21 | #'
22 | #' @seealso
23 | #' See the nzcensus package: https://github.com/ellisp/nzelect
24 | #'
25 | #' @source \url{https://www.stats.govt.nz}
26 | #' @source \url{https://en.wikipedia.org/wiki/Regions_of_New_Zealand}
27 | #' @docType data
28 | #' @keywords datasets sf
29 | #'
30 | #' @examples
31 | #' if (requireNamespace("sf", quietly = TRUE)) {
32 | #' library(sf)
33 | #' summary(nz)
34 | #' plot(nz)
35 | #' }
36 | #' \dontrun{
37 | #' # Find "Regional Council 2018 Clipped (generalised)"
38 | #' # select the GeoPackage option in the "Vectors/tables" dropdown
39 | #' # at https://datafinder.stats.govt.nz/data/ (requires registration)
40 | #' # Save the result as:
41 | #' unzip("statsnzregional-council-2018-clipped-generalised-GPKG.zip")
42 | #' library(sf)
43 | #' library(tidyverse)
44 | #' nz_full = st_read("regional-council-2018-clipped-generalised.gpkg")
45 | #' print(object.size(nz_full), units = "Kb") # 14407.2 Kb
46 | #' nz = rmapshaper::ms_simplify(nz_full, keep = 0.001, sys = TRUE)
47 | #' print(object.size(nz), units = "Kb") # 39.9 Kb
48 | #' names(nz)
49 | #' nz$REGC2018_V1_00_NAME
50 | #' nz = filter(nz, REGC2018_V1_00_NAME != "Area Outside Region") %>%
51 | #' select(Name = REGC2018_V1_00_NAME, `Land_area` = LAND_AREA_SQ_KM)
52 | #' # regions basic info
53 | #' # devtools::install_github("hadley/rvest")
54 | #' library(rvest)
55 | #' doc = read_html("https://en.wikipedia.org/wiki/Regions_of_New_Zealand") %>%
56 | #' html_nodes("div table")
57 | #' tab = doc[[3]] %>% html_table()
58 | #' tab = tab %>% select(Name = Region, Population = `Population[20]`, Island)
59 | #' tab = tab %>% mutate(Population = str_replace_all(Population, ",", "")) %>%
60 | #' mutate(Population = as.numeric(Population)) %>%
61 | #' mutate(Name = str_remove_all(Name, " \\([1-9]\\)?.+"))
62 | #' nz$Name = as.character(nz$Name)
63 | #' nz$Name = str_remove(nz$Name, " Region")
64 | #' nz$Name %in% tab$Name
65 | #' # regions additional info
66 | #' library(nzcensus)
67 | #' nz_add_data = REGC2013 %>%
68 | #' select(Name = REGC2013_N, Median_income = MedianIncome2013,
69 | #' PropFemale2013, PropMale2013) %>%
70 | #' mutate(Sex_ratio = PropMale2013 / PropFemale2013) %>%
71 | #' mutate(Name = gsub(" Region", "", Name)) %>%
72 | #' select(Name, Median_income, Sex_ratio)
73 | #' # data join
74 | #' nz = left_join(nz, tab, by = "Name") %>%
75 | #' left_join(nz_add_data, by = "Name") %>%
76 | #' select(Name, Island, Land_area, Population, Median_income, Sex_ratio)
77 | #' }
78 | "nz"
79 |
--------------------------------------------------------------------------------
/R/nz_height.R:
--------------------------------------------------------------------------------
1 | #' @name nz_height
2 | #' @title High points in New Zealand
3 | #'
4 | #' @description
5 | #'
6 | #' Top 101 heighest points in New Zealand (2017).
7 | #' See \url{https://data.linz.govt.nz/layer/50284-nz-height-points-topo-150k/} for details.
8 | #'
9 | #' @format FORMAT:
10 | #' \itemize{
11 | #' \item{t50_fid: ID}
12 | #' \item{elevation: Height above sea level in m}
13 | #' \item{geometry: sfc_POINT}
14 | #' }
15 | #'
16 | #' @source \url{https://data.linz.govt.nz}
17 | #' @docType data
18 | #' @keywords datasets sf
19 | #'
20 | #' @examples
21 | #' if (requireNamespace("sf", quietly = TRUE)) {
22 | #' library(sf)
23 | #' summary(nz_height)
24 | #' plot(nz$geom)
25 | #' plot(nz_height$geom, add = TRUE)
26 | #' }
27 | #' \dontrun{
28 | #' library(dplyr)
29 | #' # After downloading data
30 | #' unzip("lds-nz-height-points-topo-150k-SHP.zip")
31 | #' nz_height = st_read("nz-height-points-topo-150k.shp") %>%
32 | #' top_n(n = 100, wt = elevation)
33 | #' library(tmap)
34 | #' tmap_mode("view")
35 | #' qtm(nz) +
36 | #' qtm(nz_height)
37 | #' f = list.files(pattern = "*nz-height*")
38 | #' file.remove(f)
39 | #' }
40 | "nz_height"
41 |
--------------------------------------------------------------------------------
/R/properties.R:
--------------------------------------------------------------------------------
1 | #' @name properties
2 | #' @aliases properties
3 | #' @title Dataset of properties in the municipality of Athens (sf)
4 | #'
5 | #' @description A dataset of apartments in the municipality of Athens for 2017. Point location of the properties is given together with their main characteristics and the distance to the closest metro/train station.
6 | #'
7 | #' @format An sf object of 1000 points with the following 6 variables.
8 | #' \itemize{
9 | #' \item{id: An unique identifier for each property.}
10 | #' \item{size : The size of the property (unit: square meters)}
11 | #' \item{price : The asking price (unit: euros) }
12 | #' \item{prpsqm : The asking price per squre meter (unit: euroes/square meter).}
13 | #' \item{age : Age of property in 2017 (unit: years).}
14 | #' \item{dist_metro: The distance to closest train/metro station (unit: meters).}
15 | #' }
16 | #'
17 | #' @docType data
18 | #' @keywords datasets sf hierarchical spatial data
19 | #' @seealso depmunic
20 | #'
21 | #' @examples
22 | #' if (requireNamespace("sf", quietly = TRUE)) {
23 | #' if (requireNamespace("spdep", quietly = TRUE)) {
24 | #' library(sf)
25 | #' library(spdep)
26 | #'
27 | #' data(properties)
28 | #'
29 | #' summary(properties$prpsqm)
30 | #'
31 | #' pr.nb.800 <- dnearneigh(properties, 0, 800)
32 | #' pr.listw <- nb2listw(pr.nb.800)
33 | #'
34 | #' moran.test(properties$prpsqm, pr.listw)
35 | #' moran.plot(properties$prpsqm, pr.listw, xlab = "Price/m^2", ylab = "Lagged")
36 | #' }
37 | #' }
38 | "properties"
39 |
--------------------------------------------------------------------------------
/R/seine.R:
--------------------------------------------------------------------------------
1 | #' @name seine
2 | #' @aliases rivers
3 | #' @title Small river network in France
4 | #'
5 | #' @description
6 | #'
7 | #' Lines representing the Seine, Marne and Yonne rivers.
8 | #'
9 | #' @format FORMAT:
10 | #' \itemize{
11 | #' \item{name: name}
12 | #' \item{geometry: sfc_MULTILINESTRING}
13 | #' }
14 | #' The object is in the RGF93 / Lambert-93 CRS.
15 | #'
16 | #' @seealso
17 | #' See the rnaturalearth package: https://cran.r-project.org/package=rnaturalearth
18 | #'
19 | #' @source \url{https://www.naturalearthdata.com/}
20 | #'
21 | #' @docType data
22 | #' @keywords datasets sf
23 | #'
24 | #' @examples
25 | #' if (requireNamespace("sf", quietly = TRUE)) {
26 | #' library(sf)
27 | #' seine
28 | #' plot(seine)
29 | #' }
30 | #' \dontrun{
31 | #' library(sf)
32 | #' library(rnaturalearth)
33 | #' library(tidyverse)
34 | #'
35 | #' seine = ne_download(scale = 10, type = "rivers_lake_centerlines",
36 | #' category = "physical", returnclass = "sf") %>%
37 | #' filter(name %in% c("Yonne", "Seine", "Marne")) %>%
38 | #' select(name = name_en) %>%
39 | #' st_transform(2154)
40 | #' }
41 | "seine"
42 |
--------------------------------------------------------------------------------
/R/state.vbm.R:
--------------------------------------------------------------------------------
1 | #' @name state.vbm
2 | #' @aliases state.vbm
3 | #' @title US State Visibility Based Map
4 | #'
5 | #' @description A SpatialPolygonsDataFrame object to plot a Visibility Based Map.
6 | #'
7 | #' @details A SpatialPolygonsDataFrame object to plot a map of the US states where the sizes of the states have been adjusted to be more equal.
8 | #' This map can be useful for plotting state data using colors patterns without the larger states dominating and the smallest states being lost.
9 | #' The original map is copyrighted by Mark Monmonier. Official publications based on this map should acknowledge him. Comercial publications of maps based on this probably need permission from him to use.
10 | #'
11 | #' @source The data was converted from the maps library for S-PLUS. S-PLUS uses the map with permission from the author. This version of the data has not received permission from the author (no attempt made, not that it was refused), most of my uses I feel fall under fair use and do not violate copyright, but you will need to decide for yourself and your applications.
12 | #'
13 | #' @author Greg Snow \email{greg.snow@imail.org} (of this compilation)
14 | #'
15 | #' @references
16 | #' \url{http://www.markmonmonier.com/index.htm},
17 | #' \url{http://euclid.psych.yorku.ca/SCS/Gallery/bright-ideas.html}
18 | #'
19 | #' @docType data
20 | #' @keywords datasets sp
21 | #' @importClassesFrom sp SpatialPolygonsDataFrame
22 | #'
23 | #' @examples
24 | #' if (requireNamespace("sp", quietly = TRUE)) {
25 | #' library(sp)
26 | #' data(state.vbm)
27 | #' plot(state.vbm)
28 | #'
29 | #' tmp <- state.x77[, 'HS Grad']
30 | #' tmp2 <- cut(tmp, seq(min(tmp), max(tmp), length.out=11),
31 | #' include.lowest=TRUE)
32 | #' plot(state.vbm, col=cm.colors(10)[tmp2])
33 | #' }
34 | "state.vbm"
35 |
--------------------------------------------------------------------------------
/R/urban_agglomerations.R:
--------------------------------------------------------------------------------
1 | #' @name urban_agglomerations
2 | #' @aliases urban_agglomerations
3 | #' @title Major urban areas worldwide
4 | #'
5 | #' @description Dataset in a 'long' form from the United Nations
6 | #' population division with projections up to 2050.
7 | #' Includes only the top 30 largest areas by population at 5 year intervals.
8 | #'
9 | #' @format
10 | #' Selected variables:
11 | #' \itemize{
12 | #' \item{year: Year of population estimate}
13 | #' \item{country_code: Code of country}
14 | #' \item{urban_agglomeration: Name of the urban agglomeration}
15 | #' \item{population_millions: Estimated human population}
16 | #' \item{geometry: sfc_POINT}
17 | #' }
18 | #'
19 | #' @docType data
20 | #' @keywords datasets sf
21 | #'
22 | #' @examples
23 | #' if (requireNamespace("sf", quietly = TRUE)) {
24 | #' library(sf)
25 | #' plot(urban_agglomerations)
26 | #' }
27 | #' # Code used to download the data:
28 | #' \dontrun{
29 | #' f = "WUP2018-F11b-30_Largest_Cities_in_2018_by_time.xls"
30 | #' download.file(
31 | #' destfile = f,
32 | #' url = paste0("https://population.un.org/wup/Download/Files/", f)
33 | #' )
34 | #' library(dplyr)
35 | #' library(sf)
36 | #' urban_agglomerations = readxl::read_excel(f, skip = 16) %>%
37 | #' st_as_sf(coords = c("Longitude", "Latitude"), crs = 4326)
38 | #' names(urban_agglomerations)
39 | #' names(urban_agglomerations) <- gsub(" |\\n", "_", tolower(names(urban_agglomerations)) ) %>%
40 | #' gsub("\\(|\\)", "", .)
41 | #' names(urban_agglomerations)
42 | #' urban_agglomerations
43 | #' usethis::use_data(urban_agglomerations, overwrite = TRUE)
44 | #' file.remove("WUP2018-F11b-30_Largest_Cities_in_2018_by_time.xls")
45 | #' }
46 | "urban_agglomerations"
47 |
--------------------------------------------------------------------------------
/R/us_states.R:
--------------------------------------------------------------------------------
1 | #' @name us_states
2 | #' @title US states polygons
3 | #'
4 | #' @description The object loaded is a \code{sf} object containing the contiguous United States data from the US Census Bureau
5 | #' with a few variables from American Community Survey (ACS)
6 | #'
7 | #' @format Formal class 'sf' [package "sf"]; the data contains a data.frame with 49 obs. of 7 variables:
8 | #' \itemize{
9 | #' \item{GEOID: character vector of geographic identifiers}
10 | #' \item{NAME: character vector of state names}
11 | #' \item{REGION: character vector of region names}
12 | #' \item{AREA: area in square kilometers of units class}
13 | #' \item{total_pop_10: numerical vector of total population in 2010}
14 | #' \item{total_pop_15: numerical vector of total population in 2015}
15 | #' \item{geometry: sfc_MULTIPOLYGON}
16 | #' }
17 | #' The object is in geographical coordinates using the NAD83 datum.
18 | #'
19 | #' @seealso
20 | #' See the tigris package: https://cran.r-project.org/package=tigris
21 | #'
22 | #' @source \url{https://www.census.gov/geographies/mapping-files/time-series/geo/tiger-line-file.html}
23 | #' @docType data
24 | #' @keywords datasets sf
25 | #' @examples
26 | #' if (requireNamespace("sf", quietly = TRUE)) {
27 | #' library(sf)
28 | #' data(us_states)
29 | #'
30 | #' plot(us_states["REGION"])
31 | #' }
32 | "us_states"
33 |
--------------------------------------------------------------------------------
/R/us_states_df.R:
--------------------------------------------------------------------------------
1 | #' @name us_states_df
2 | #' @title the American Community Survey (ACS) data
3 | #'
4 | #' @description The object loaded is a \code{data.frame} object containing the US states data from the American Community Survey (ACS)
5 | #'
6 | #' @format Formal class 'data.frame'; the data contains a data.frame with 51 obs. of 5 variables:
7 | #' \itemize{
8 | #' \item{state: character vector of state names}
9 | #' \item{median_income_10: numerical vector of median income in 2010}
10 | #' \item{median_income_15: numerical vector of median income in 2010}
11 | #' \item{poverty_level_10: numerical vector of number of people with income below poverty level in 2010}
12 | #' \item{poverty_level_15: numerical vector of number of people with income below poverty level in 2015}
13 | #' }
14 | #'
15 | #' @seealso
16 | #' See the tidycensus package: https://cran.r-project.org/package=tidycensus
17 | #'
18 | #' @source \url{https://www.census.gov/programs-surveys/acs/}
19 | #' @docType data
20 | #' @keywords datasets
21 | #' @examples
22 | #' data(us_states_df)
23 | #'
24 | #' summary(us_states_df)
25 | #'
26 | "us_states_df"
27 |
--------------------------------------------------------------------------------
/R/used.cars.R:
--------------------------------------------------------------------------------
1 | #' @name used.cars
2 | #' @aliases used.cars usa48.nb
3 | #' @title US 1960 used car prices
4 | #'
5 | #' @description The \code{used.cars} data frame has 48 rows and 2 columns. The data set includes a neighbours list for the 48 states excluding DC from poly2nb().
6 | #'
7 | #' @format This data frame contains the following columns:
8 | #' \itemize{
9 | #' \item{tax.charges: taxes and delivery charges for 1955-9 new cars}
10 | #' \item{price.1960: 1960 used car prices by state}
11 | #' }
12 | #'
13 | #' @source Hanna, F. A. 1966 Effects of regional differences in taxes and transport charges on automobile consumption, in Ostry, S., Rhymes, J. K. (eds) Papers on regional statistical studies, Toronto: Toronto University Press, pp. 199-223.
14 | #' @references Hepple, L. W. 1976 A maximum likelihood model for econometric estimation with spatial series, in Masser, I (ed) Theory and practice in regional science, London: Pion, pp. 90-104.
15 | #' @docType data
16 | #' @keywords datasets spdep
17 | #'
18 | #' @examples
19 | #' if (requireNamespace("spdep", quietly = TRUE)) {
20 | #' library(spdep)
21 | #' data(used.cars)
22 | #' moran.test(used.cars$price.1960, nb2listw(usa48.nb))
23 | #' moran.plot(used.cars$price.1960, nb2listw(usa48.nb),
24 | #' labels=rownames(used.cars))
25 | #' uc.lm <- lm(price.1960 ~ tax.charges, data=used.cars)
26 | #' summary(uc.lm)
27 | #'
28 | #' lm.morantest(uc.lm, nb2listw(usa48.nb))
29 | #' lm.morantest.sad(uc.lm, nb2listw(usa48.nb))
30 | #' lm.LMtests(uc.lm, nb2listw(usa48.nb))
31 | #'\donttest{
32 | #' if (requireNamespace("spatialreg", quietly = TRUE)) {
33 | #' library(spatialreg)
34 | #' uc.err <- errorsarlm(price.1960 ~ tax.charges, data=used.cars,
35 | #' nb2listw(usa48.nb), tol.solve=1.0e-13,
36 | #' control=list(tol.opt=.Machine$double.eps^0.3))
37 | #' summary(uc.err)
38 | #' uc.lag <- lagsarlm(price.1960 ~ tax.charges, data=used.cars,
39 | #' nb2listw(usa48.nb), tol.solve=1.0e-13,
40 | #' control=list(tol.opt=.Machine$double.eps^0.3))
41 | #' summary(uc.lag)
42 | #' uc.lag1 <- lagsarlm(price.1960 ~ 1, data=used.cars,
43 | #' nb2listw(usa48.nb), tol.solve=1.0e-13,
44 | #' control=list(tol.opt=.Machine$double.eps^0.3))
45 | #' summary(uc.lag1)
46 | #' uc.err1 <- errorsarlm(price.1960 ~ 1, data=used.cars,
47 | #' nb2listw(usa48.nb), tol.solve=1.0e-13,
48 | #' control=list(tol.opt=.Machine$double.eps^0.3),
49 | #' Durbin=FALSE)
50 | #' summary(uc.err1)
51 | #' }
52 | #' }
53 | #' }
54 | "used.cars"
55 |
--------------------------------------------------------------------------------
/R/wheat.R:
--------------------------------------------------------------------------------
1 | #' @name wheat
2 | #' @aliases wheat
3 | #' @title Mercer and Hall wheat yield data
4 | #'
5 | #' @description Mercer and Hall wheat yield data, based on version in Cressie (1993), p. 455.
6 | #'
7 | #' @format The format of the object generated by running \code{data(wheat)} is a three column data frame made available by Hongfei Li. The example section shows how to convert this to the object used in demonstrating the \code{aple} function, and is a formal class 'SpatialPolygonsDataFrame' [package "sp"] with 5 slots; the data slot is a data frame with 500 observations on the following 6 variables.
8 | #' \itemize{
9 | #' \item{lat: local coordinates northings ordered north to south}
10 | #' \item{yield: Mercer and Hall wheat yield data}
11 | #' \item{r: rows south to north; levels in distance units of plot centres}
12 | #' \item{c: columns west to east; levels in distance units of plot centres}
13 | #' \item{lon: local coordinates eastings}
14 | #' \item{lat1: local coordinates northings ordered south to north}
15 | #' }
16 | #' @note The value of 4.03 was changed to 4.33 (wheat[71,]) 13 January 2014; thanks to Sandy Burden; cross-checked with http://www.itc.nl/personal/rossiter/teach/R/mhw.csv, which agrees.
17 | #'
18 | #' @source Cressie, N. A. C. (1993) Statistics for Spatial Data. Wiley, New York, p. 455.
19 | #' @references Mercer, W. B. and Hall, A. D. (1911) The experimental error of field trials. Journal of Agricultural Science 4, 107-132.
20 | #' @docType data
21 | #' @keywords datasets sf
22 | #'
23 | #' @examples
24 | #' \donttest{
25 | #' if (requireNamespace("sp", quietly = TRUE)) {
26 | #' library(sp)
27 | #' data(wheat)
28 | #' wheat$lat1 <- 69 - wheat$lat
29 | #' wheat$r <- factor(wheat$lat1)
30 | #' wheat$c <- factor(wheat$lon)
31 | #' wheat_sp <- wheat
32 | #' coordinates(wheat_sp) <- c("lon", "lat1")
33 | #' wheat_spg <- wheat_sp
34 | #'
35 | #' gridded(wheat_spg) <- TRUE
36 | #' wheat_spl <- as(wheat_spg, "SpatialPolygons")
37 | #' df <- as(wheat_spg, "data.frame")
38 | #' row.names(df) <- sapply(slot(wheat_spl, "polygons"),
39 | #' function(x) slot(x, "ID"))
40 | #' wheat <- SpatialPolygonsDataFrame(wheat_spl, data=df)
41 | #' }
42 | #' }
43 | #'
44 | #' if (requireNamespace("sf", quietly = TRUE)) {
45 | #' library(sf)
46 | #' wheat <- st_read(system.file("shapes/wheat.gpkg", package="spData"))
47 | #' plot(wheat)
48 | #' }
49 | "wheat"
50 |
--------------------------------------------------------------------------------
/R/world.R:
--------------------------------------------------------------------------------
1 | #' @name world
2 | #' @aliases wrld
3 | #' @title World country polygons
4 | #'
5 | #' @description The object loaded is a \code{sf} object containing a world map data from Natural Earth with a few variables from World Bank
6 | #'
7 | #' @format Formal class 'sf' [package "sf"]; the data contains a data.frame with 177 obs. of 11 variables:
8 | #' \itemize{
9 | #' \item{iso_a2: character vector of ISO 2 character country codes}
10 | #' \item{name_long: character vector of country names}
11 | #' \item{continent: character vector of continent names}
12 | #' \item{region_un: character vector of region names}
13 | #' \item{subregion: character vector of subregion names}
14 | #' \item{type: character vector of type names}
15 | #' \item{area_km2: integer vector of area values}
16 | #' \item{pop: integer vector of population in 2014}
17 | #' \item{lifeExp: integer vector of life expectancy at birth in 2014}
18 | #' \item{gdpPercap: integer vector of per-capita GDP in 2014}
19 | #' \item{geom: sfc_MULTIPOLYGON}
20 | #' }
21 | #' The object is in geographical coordinates using the WGS84 datum.
22 | #'
23 | #' @seealso
24 | #' See the rnaturalearth package: https://cran.r-project.org/package=rnaturalearth
25 | #'
26 | #' @source \url{https://www.naturalearthdata.com/}
27 | #' @source \url{https://data.worldbank.org/}
28 | #' @docType data
29 | #' @keywords datasets sf
30 | #' @examples
31 | #' if (requireNamespace("sf", quietly = TRUE)) {
32 | #' library(sf)
33 | #' data(world)
34 | #' # or
35 | #' world <- st_read(system.file("shapes/world.gpkg", package="spData"))
36 | #'
37 | #' plot(world)
38 | #' }
39 | "world"
40 |
--------------------------------------------------------------------------------
/R/worldbank_df.R:
--------------------------------------------------------------------------------
1 | #' @name worldbank_df
2 | #' @aliases worldbank_df
3 | #' @title World Bank data
4 | #'
5 | #' @description The object loaded is a \code{data.frame} object containing data from World Bank
6 | #'
7 | #' @format Formal class 'data.frame'; the data contains a data.frame with 177 obs. of 7 variables:
8 | #' \itemize{
9 | #' \item{name: character vector of country names}
10 | #' \item{iso_a2: character vector of ISO 2 character country codes}
11 | #' \item{HDI: human development index (HDI)}
12 | #' \item{urban_pop: urban population}
13 | #' \item{unemployment: unemployment, total (\% of total labor force)}
14 | #' \item{pop_growth: population growth (annual \%)}
15 | #' \item{literacy: adult literacy rate, population 15+ years, both sexes (\%)}
16 | #' }
17 | #'
18 | #' @seealso
19 | #' See the wbstats package: https://cran.r-project.org/web/packages/wbstats
20 | #'
21 | #' @source \url{https://data.worldbank.org/}
22 | #' @docType data
23 | #' @keywords datasets
24 | #' @examples
25 | #' data(worldbank_df)
26 | #' # or
27 | #' worldbank_df <- read.csv(system.file("misc/worldbank_df.csv", package="spData"))
28 | #'
29 | #' summary(worldbank_df)
30 | #'
31 | "worldbank_df"
32 |
--------------------------------------------------------------------------------
/R/zzz.R:
--------------------------------------------------------------------------------
1 | .pkgenv <- new.env(parent = emptyenv())
2 |
3 | .onLoad <- function(libname, pkgname) {
4 | has_data <- requireNamespace("spDataLarge", quietly = TRUE)
5 | .pkgenv[["has_data"]] <- has_data
6 | # repos = getOption("repos")
7 | # repos["nowosaddrat"] = "https://nowosad.github.io/drat/"
8 | # options(repos = repos)
9 | # invisible(repos)
10 | }
11 |
12 | .onAttach <- function(libname, pkgname) {
13 | if (!.pkgenv$has_data) {
14 | msg <- paste("To access larger datasets in this package, install the",
15 | "spDataLarge package with:\n",
16 | "`install.packages('spDataLarge',",
17 | "repos='https://nowosad.github.io/drat/', type='source')`")
18 | msg <- paste(strwrap(msg), collapse="\n")
19 | packageStartupMessage(msg)
20 | }
21 | }
22 |
23 | hasData <- function(has_data = .pkgenv$has_data) {
24 | if (!has_data) {
25 | msg <- paste("To use this function, you must have the",
26 | "`spDataLarge` package installed.")
27 | msg <- paste(strwrap(msg), collapse="\n")
28 | stop(msg)
29 | }
30 | }
--------------------------------------------------------------------------------
/README.Rmd:
--------------------------------------------------------------------------------
1 | ---
2 | output:
3 | github_document
4 | ---
5 |
6 |
7 | ```{r, echo = FALSE}
8 | knitr::opts_chunk$set(
9 | collapse = TRUE,
10 | comment = "#>",
11 | fig.path = "figure/",
12 | fig.height = 1
13 | )
14 | ```
15 |
16 | # spData
17 |
18 | [](https://github.com/Nowosad/spData/actions)
19 | [](https://cran.r-project.org/package=spData)
20 | [](https://cran.r-project.org/package=spData)
21 | [](https://cran.r-project.org/package=spData)
22 |
23 | Datasets for spatial analysis (from version 2.3.4, ESRI Shapefile datasets have been dropped, use the provided GeoPackage files instead)
24 |
25 | ### **sf**
26 |
27 | - `alaska` - Alaska multipolygon
28 | - `aggregating_zones` - See `congruent`
29 | - `congruent` - Sample of UK administrative zones that have shared borders with `aggregating_zones` (`incongruent` does not have shared borders) for teaching the concept of spatial congruence
30 | - `cycle_hire` - Cycle hire points in London
31 | - `cycle_hire_osm` - Cycle hire points in London from OSM
32 | - `hawaii` - Hawaii multipolygon
33 | - `incongruent` - See `congruent`
34 | - `lnd` - The boroughs of London
35 | - `nz` - The regions of New Zealand
36 | - `nz_height` - High points in New Zealand
37 | - `seine` - Small river network in France
38 | - `urban_agglomerations` - Major urban areas worldwide
39 | - `us_states` - US states polygons
40 | - `world` - World country polygons
41 |
42 | ### **sp**
43 |
44 | - `auckland` - Marshall's infant mortality in Auckland dataset
45 | - `elect80` - 1980 Presidential election results
46 | - `house` - Lucas county OH housing
47 | - `SplashDams` - Data for Splash Dams in western Oregon
48 | - `state.vbm` - US State Visibility Based Map
49 |
50 | ### **spdep**
51 |
52 | - `afcon` - Spatial patterns of conflict in Africa 1966-78
53 | - `boston` - Boston Housing Data
54 | - `columbus` - Columbus OH spatial analysis data set
55 | - `eire` - Eire data sets
56 | - `nc.sids` - North Carolina SIDS data
57 | - `NY_data` - New York leukemia data
58 | - `used.cars` - US 1960 used car prices
59 |
60 | ### **raster**
61 |
62 | - `elev.tif` - Small raster dataset representing elevation values
63 | - `grain.tif` - Small raster dataset representing grain size classes
64 |
65 | ### misc
66 |
67 | - `baltimore` - House sales prices, Baltimore, MD 1978
68 | - `coffee_data` - World coffee production statistics by country, 2016 and 2017
69 | - `getisord` - Getis-Ord remote sensing example data
70 | - `hopkins` - Hopkins burnt savanna herb remains
71 | - `huddersfield` - Prevalence of respiratory symptoms
72 | - `jenks71` - Illinois 1959 county gross farm product value per acre
73 | - `us_states_df` - Selected American Community Survey (ACS) data
74 | - `wheat` - Mercer and Hall wheat yield data
75 | - `worldbank_df` - Selected World Bank data
76 | - `depmunic` and `properties` - Athens properties data set from **HSAR**
77 |
78 | ## Installation
79 |
80 | Get the released version from CRAN:
81 |
82 | ```R
83 | install.packages("spData")
84 | ```
85 |
86 | Get the development version from github:
87 |
88 | ```R
89 | devtools::install_github("nowosad/spData")
90 | ```
91 |
92 | ## spDataLarge
93 |
94 | This package interacts with data available through the **spDataLarge** package, which is available in a 'drat' repository.
95 | To access this data package, run:
96 |
97 | ```R
98 | install.packages("spDataLarge", repos = "https://nowosad.github.io/drat/", type = "source")
99 | ```
100 |
101 | The size of the **spDataLarge** package is approximately 20 MB.
102 | Learn more about the **spDataLarge** package at https://github.com/Nowosad/spDataLarge.
103 |
104 | ## Contributions
105 |
106 | [Feel free to submit issues and enhancement requests.](https://github.com/Nowosad/spData/issues)
107 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | # spData
5 |
6 | [](https://github.com/Nowosad/spData/actions)
8 | [](https://cran.r-project.org/package=spData)
10 | [](https://cran.r-project.org/package=spData)
12 | [](https://cran.r-project.org/package=spData)
14 |
15 | Datasets for spatial analysis (from version 2.3.4, ESRI Shapefile
16 | datasets have been dropped, use the provided GeoPackage files instead)
17 |
18 | ### **sf**
19 |
20 | - `alaska` - Alaska multipolygon
21 | - `aggregating_zones` - See `congruent`
22 | - `congruent` - Sample of UK administrative zones that have shared
23 | borders with `aggregating_zones` (`incongruent` does not have shared
24 | borders) for teaching the concept of spatial congruence
25 | - `cycle_hire` - Cycle hire points in London
26 | - `cycle_hire_osm` - Cycle hire points in London from OSM
27 | - `hawaii` - Hawaii multipolygon
28 | - `incongruent` - See `congruent`
29 | - `lnd` - The boroughs of London
30 | - `nz` - The regions of New Zealand
31 | - `nz_height` - High points in New Zealand
32 | - `seine` - Small river network in France
33 | - `urban_agglomerations` - Major urban areas worldwide
34 | - `us_states` - US states polygons
35 | - `world` - World country polygons
36 |
37 | ### **sp**
38 |
39 | - `auckland` - Marshall’s infant mortality in Auckland dataset
40 | - `elect80` - 1980 Presidential election results
41 | - `house` - Lucas county OH housing
42 | - `SplashDams` - Data for Splash Dams in western Oregon
43 | - `state.vbm` - US State Visibility Based Map
44 |
45 | ### **spdep**
46 |
47 | - `afcon` - Spatial patterns of conflict in Africa 1966-78
48 | - `boston` - Boston Housing Data
49 | - `columbus` - Columbus OH spatial analysis data set
50 | - `eire` - Eire data sets
51 | - `nc.sids` - North Carolina SIDS data
52 | - `NY_data` - New York leukemia data
53 | - `used.cars` - US 1960 used car prices
54 |
55 | ### **raster**
56 |
57 | - `elev.tif` - Small raster dataset representing elevation values
58 | - `grain.tif` - Small raster dataset representing grain size classes
59 |
60 | ### misc
61 |
62 | - `baltimore` - House sales prices, Baltimore, MD 1978
63 | - `coffee_data` - World coffee production statistics by country, 2016
64 | and 2017
65 | - `getisord` - Getis-Ord remote sensing example data
66 | - `hopkins` - Hopkins burnt savanna herb remains
67 | - `huddersfield` - Prevalence of respiratory symptoms
68 | - `jenks71` - Illinois 1959 county gross farm product value per acre
69 | - `us_states_df` - Selected American Community Survey (ACS) data
70 | - `wheat` - Mercer and Hall wheat yield data
71 | - `worldbank_df` - Selected World Bank data
72 | - `depmunic` and `properties` - Athens properties data set from **HSAR**
73 |
74 | ## Installation
75 |
76 | Get the released version from CRAN:
77 |
78 | ``` r
79 | install.packages("spData")
80 | ```
81 |
82 | Get the development version from github:
83 |
84 | ``` r
85 | devtools::install_github("nowosad/spData")
86 | ```
87 |
88 | ## spDataLarge
89 |
90 | This package interacts with data available through the **spDataLarge**
91 | package, which is available in a ‘drat’ repository. To access this data
92 | package, run:
93 |
94 | ``` r
95 | install.packages("spDataLarge", repos = "https://nowosad.github.io/drat/", type = "source")
96 | ```
97 |
98 | The size of the **spDataLarge** package is approximately 20 MB. Learn
99 | more about the **spDataLarge** package at
100 | .
101 |
102 | ## Contributions
103 |
104 | [Feel free to submit issues and enhancement
105 | requests.](https://github.com/Nowosad/spData/issues)
106 |
--------------------------------------------------------------------------------
/_pkgdown.yml:
--------------------------------------------------------------------------------
1 | template:
2 | bootstrap: 5
3 | url: https://jakubnowosad.com/spData/
4 |
--------------------------------------------------------------------------------
/data-raw/create-rasters.R:
--------------------------------------------------------------------------------
1 | set.seed(2017-12-16)
2 | library(terra)
3 | elev = rast(nrow = 6, ncol = 6, resolution = 0.5,
4 | xmin = -1.5, xmax = 1.5, ymin = -1.5, ymax = 1.5,
5 | vals = 1:36)
6 | names(elev) = "elev"
7 |
8 | grain_size = c("clay", "silt", "sand")
9 | grain = rast(nrow = 6, ncol = 6, resolution = 0.5,
10 | xmin = -1.5, xmax = 1.5, ymin = -1.5, ymax = 1.5,
11 | vals = factor(sample(grain_size, 36, replace = TRUE),
12 | levels = grain_size))
13 | names(grain) = "grain"
14 |
15 | writeRaster(elev, "inst/raster/elev.tif")
16 | writeRaster(grain, "inst/raster/grain.tif")
17 |
--------------------------------------------------------------------------------
/data-raw/data-download.R:
--------------------------------------------------------------------------------
1 | # Code used to download data from external sources
2 |
3 | # cycle hire data (OSM) ---------------------------------------------------------
4 | library(osmdata)
5 | library(dplyr)
6 | library(sf)
7 | q = add_feature(opq = opq("London"), key = "network", value = "tfl_cycle_hire")
8 | lnd_cycle_hire = osmdata_sf(q)
9 | lnd_cycle_p = lnd_cycle_hire$osm_points
10 | names(lnd_cycle_p)
11 | lnd_cycle_p_mini = select(lnd_cycle_p, osm_id, name, capacity, cyclestreets_id, description)
12 | cycle_hire_osm = lnd_cycle_p_mini
13 | devtools::use_data(cycle_hire_osm)
14 |
15 | object.size(lnd_cycle_p) / 1000000
16 | object.size(lnd_cycle_p_mini) / 1000000
17 |
18 | # cycle hire data (official) ---------------------------------------------------
19 | library(osmdata)
20 | library(dplyr)
21 | library(sf)
22 | cycle_hire = cycle_hire_orig = readr::read_csv("http://cyclehireapp.com/cyclehirelive/cyclehire.csv", col_names = FALSE, skip = TRUE)
23 | c_names = c("id", "name", "area", "lat", "lon", "nbikes", "nempty")
24 | names(cycle_hire) = c_names
25 | cycle_hire_small = cycle_hire[c_names]
26 | cycle_hire = st_as_sf(cycle_hire_small, coords = c("lon", "lat"))
27 | plot(cycle_hire) # looks right
28 | class(cycle_hire) # class sf and tbl
29 | devtools::use_data(cycle_hire)
30 |
31 |
32 | # worldbank ---------------------------------------------------
33 | # install.packages("wbstats")
34 | # remotes::install_github("ropenscilabs/rnaturalearth")
35 | library(wbstats)
36 | library(rnaturalearth)
37 | library(tidyverse)
38 | library(sf)
39 | library(viridis)
40 |
41 | # query_lifeexp = wbsearch(pattern = "life expectancy")
42 | # query_gdp = wbsearch("GDP")
43 |
44 | wb_data_create = function(indicator, our_name, year, ...){
45 | df = wb(indicator = indicator, startdate = year, enddate = year, ...) %>%
46 | as_data_frame() %>%
47 | select(iso_a2=iso2c, value) %>%
48 | mutate(indicator = our_name) %>%
49 | spread(indicator, value)
50 | return(df)
51 | }
52 |
53 | ## IMPORTANT - repeat if a server is down
54 |
55 | data_pop = wb_data_create(indicator = "SP.POP.TOTL", our_name = "pop", year = 2014, country = "countries_only")
56 | data_lifeexp = wb_data_create(indicator = "SP.DYN.LE00.IN", our_name = "lifeExp", year = 2014, country = "countries_only")
57 | data_gdp = wb_data_create("NY.GDP.PCAP.PP.KD", "gdpPercap", year = 2014, country = "countries_only")
58 |
59 | world_sf = ne_countries(returnclass = 'sf') %>%
60 | left_join(., data_pop, by = c('iso_a2')) %>%
61 | left_join(., data_lifeexp, by = c('iso_a2')) %>%
62 | left_join(., data_gdp, by = c('iso_a2')) %>%
63 | mutate(area_km2 = raster::area(as(., "Spatial")) / 1000000) %>%
64 | select(iso_a2, name_long, continent, region_un, subregion, type, area_km2, pop, lifeExp, gdpPercap)
65 |
66 | # world_sf %>% st_write(., 'wrld.gpkg')
67 |
68 | plot(world_sf)
69 | ggplot(world_sf, aes(fill=pop)) +
70 | geom_sf() +
71 | scale_fill_viridis() +
72 | theme_void()
73 |
74 | # zion borders ---------------------------------------------
75 | library(sf)
76 | library(tidyverse)
77 |
78 | dir.create('data')
79 | download.file("https://irma.nps.gov/DataStore/DownloadFile/570816", "data/nps_boundary.zip")
80 | unzip("data/nps_boundary.zip", exdir = "data")
81 | st_read('data/nps_boundary.shp') %>%
82 | filter(PARKNAME=="Zion") %>%
83 | st_transform(., 26912) %>%
84 | st_write('data/zion.gpkg', delete_dsn = TRUE)
85 |
86 | dir(path="data", pattern="nps_boundary.*", full.names = TRUE) %>%
87 | file.remove(.)
88 |
89 | # landsat -------------------------------------------------------
90 | # https://aws.amazon.com/public-data-sets/landsat/
91 | download_landsat8 = function(destination_filename, band){
92 | filename = paste0("http://landsat-pds.s3.amazonaws.com/L8/038/034/LC80380342015230LGN00/LC80380342015230LGN00_B", band, ".TIF")
93 | download.file(filename, destination_filename, method='auto')
94 | }
95 |
96 | download_landsat8('data/landsat_b2.tif', 2)
97 | download_landsat8('data/landsat_b3.tif', 3)
98 | download_landsat8('data/landsat_b4.tif', 4)
99 | download_landsat8('data/landsat_b5.tif', 5)
100 |
101 | # landsat crop
102 | library(raster)
103 | zion = st_read('data/zion.gpkg') %>%
104 | st_buffer(., 500) %>%
105 | as(., "Spatial") %>%
106 | extent(.)
107 |
108 | zion_crop = function(landsat_filename, zion){
109 | new_name = paste0(stringr::str_sub(landsat_filename, end=-5), '_zion.tif')
110 | landsat_filename %>%
111 | raster(.) %>%
112 | crop(., zion) %>%
113 | writeRaster(., new_name, overwrite=TRUE, datatype="INT2U", options=c("COMPRESS=DEFLATE"))
114 | landsat_filename %>%
115 | file.remove(.)
116 | }
117 |
118 | zion_landsats = c('data/landsat_b2.tif',
119 | 'data/landsat_b3.tif',
120 | 'data/landsat_b4.tif',
121 | 'data/landsat_b5.tif')
122 |
123 | zion_landsats %>%
124 | map(~zion_crop(., zion))
125 |
126 | ### worldbank data -------------------------------------------------------------
127 | library(wbstats)
128 | library(tidyverse)
129 | library(sf)
130 | library(rnaturalearth)
131 |
132 |
133 | wbsearch("HDI")
134 | wbsearch("urbanization")
135 | wbsearch("unemployment")
136 | wbsearch("Population growth rate")
137 | wbsearch("literacy")
138 | # wbsearch("poverty")
139 | # wbsearch("migration")
140 | # wbsearch("net exports")
141 | wbsearch("education")
142 | # worldbank wiki
143 |
144 | # query_lifeexp = wbsearch(pattern = "life expectancy")
145 | # query_gdp = wbsearch("GDP")
146 |
147 | wb_data_create = function(indicator, our_name, year, ...){
148 | df = wb(indicator = indicator, startdate = year, enddate = year, ...) %>%
149 | as_data_frame() %>%
150 | select(iso_a2=iso2c, value) %>%
151 | mutate(indicator = our_name) %>%
152 | spread(indicator, value)
153 | return(df)
154 | }
155 |
156 | ## IMPORTANT - repeat if a server is down
157 |
158 | data_hdi = wb_data_create(indicator = "UNDP.HDI.XD", our_name = "HDI", year = 2011, country = "countries_only")
159 | data_urbanpop = wb_data_create(indicator = "SP.URB.TOTL", our_name = "urban_pop", year = 2014, country = "countries_only")
160 | data_unemployment = wb_data_create(indicator = "SL.UEM.TOTL.NE.ZS", our_name = "unemployment", year = 2014, country = "countries_only")
161 | data_popgrowth = wb_data_create(indicator = "SP.POP.GROW", our_name = "pop_growth", year = 2014, country = "countries_only")
162 | data_literacy = wb_data_create(indicator = "SE.ADT.LITR.ZS", our_name = "literacy", year = 2014, country = "countries_only")
163 | # data_tertiary_edu_per_100000 = wb_data_create(indicator = "UIS.TE_100000.56", our_name = "tertiary_edu_per_100000", year = 2014, country = "countries_only")
164 |
165 | country_names = ne_countries(returnclass = 'sf') %>%
166 | select(name = name_long, iso_a2) %>%
167 | st_drop_geometry()
168 |
169 | world_df = data_hdi %>%
170 | full_join(., data_urbanpop, by = c('iso_a2')) %>%
171 | full_join(., data_unemployment, by = c('iso_a2')) %>%
172 | full_join(., data_popgrowth, by = c('iso_a2')) %>%
173 | full_join(., data_literacy, by = c('iso_a2')) %>%
174 | # full_join(., data_tertiary_edu_per_100000, by = c('iso_a2')) %>%
175 | right_join(., country_names, by = c('iso_a2')) %>%
176 | select(name, everything()) %>%
177 | mutate(name = stringi::stri_trans_general(name, "latin-ascii"))
178 |
179 | write_csv(worldbank_df, 'data/worldbank_df.csv')
180 | save(worldbank_df, file = "data/worldbank_df.rda", compress = "bzip2")
181 |
--------------------------------------------------------------------------------
/data-raw/data_us_states.R:
--------------------------------------------------------------------------------
1 | # devtools::install_github('walkerke/tigris')
2 | # devtools::install_github('walkerke/tidycensus')
3 | # devtools::install_github('ateucher/rmapshaper', ref = 'sf')
4 | library(tigris)
5 | library(tidycensus)
6 | library(sf)
7 | library(tidyverse)
8 | library(units)
9 | library(rmapshaper)
10 |
11 | options(tigris_class = "sf")
12 |
13 | # census data -------------------------------------------------------------
14 | census_api_key("YOUR API KEY") # http://api.census.gov/data/key_signup.html
15 |
16 | # v15 = load_variables(2015, "acs5", cache = TRUE)
17 | # View(v15)
18 | # v15 %>% select(concept) %>% unique() %>% View
19 | # B01003_001E - total pop
20 |
21 | total_pop_10 = get_acs(geography = "state", variables = "B01003_001E", year = 2010) %>%
22 | select(GEOID, total_pop_10 = estimate)
23 | total_pop_15 = get_acs(geography = "state", variables = "B01003_001E", year = 2015) %>%
24 | select(GEOID, total_pop_15 = estimate)
25 |
26 | ## groups - Census Bureau-designated regions
27 |
28 | # spatial data -----------------------------------------------------------
29 | us_states = states(cb = TRUE, resolution = '5m')
30 | us_states_large = states()
31 | # extract regions ---------------------------------------------------------
32 | us_regions = us_states_large %>%
33 | filter(DIVISION != 0) %>%
34 | filter(NAME != "Alaska", NAME != "Hawaii") %>%
35 | mutate(REGION = factor(REGION, labels = c("Norteast", "Midwest", "South", "West"))) %>%
36 | select(NAME, REGION) %>%
37 | st_drop_geometry()
38 |
39 | # cont states -------------------------------------------------------------
40 | us_states49 = us_states %>%
41 | filter(NAME != "Alaska", NAME != "Hawaii") %>%
42 | inner_join(us_regions, by = "NAME") %>%
43 | ms_simplify(keep = 0.05) %>%
44 | select(GEOID, NAME, REGION) %>%
45 | mutate(AREA = units::set_units(st_area(.), km^2)) %>%
46 | left_join(., total_pop_10, by = "GEOID") %>%
47 | left_join(., total_pop_15, by = "GEOID")
48 |
49 | us_states = us_states49
50 | save(us_states, file = "data/us_states.rda", compress = "bzip2")
51 |
52 | # hawaii ------------------------------------------------------------------
53 | hawaii2 = us_states_large %>%
54 | filter(DIVISION != 0) %>%
55 | filter(NAME == "Hawaii") %>%
56 | ms_simplify(keep = 0.05, keep_shapes = TRUE, explode = TRUE) %>%
57 | aggregate(by = list(.$GEOID), first) %>%
58 | select(GEOID, NAME, REGION) %>%
59 | mutate(REGION = factor(REGION, labels = c("West"))) %>%
60 | mutate(AREA = units::set_units(st_area(.), km^2)) %>%
61 | left_join(., total_pop_10, by = "GEOID") %>%
62 | left_join(., total_pop_15, by = "GEOID") %>%
63 | st_transform("+proj=aea +lat_1=8 +lat_2=18 +lat_0=13 +lon_0=-157 +x_0=0 +y_0=0 +ellps=GRS80 +datum=NAD83 +units=m +no_defs ")
64 |
65 | # removes island outside Hawaii
66 | hawaii_bbox = st_as_sfc(st_bbox(c(xmin = -450000, xmax = 235806.2, ymax = 1100000, ymin = 650905.7), crs = st_crs(hawaii2)))
67 | hawaii2 = hawaii2 %>%
68 | st_intersection(hawaii_bbox)
69 |
70 | hawaii = hawaii2
71 |
72 | save(hawaii, file = "data/hawaii.rda", compress = "bzip2")
73 | # alaska ------------------------------------------------------------------
74 | alaska = us_states_large %>%
75 | filter(DIVISION != 0) %>%
76 | filter(NAME == "Alaska") %>%
77 | ms_simplify(keep = 0.05, keep_shapes = TRUE, explode = TRUE) %>%
78 | aggregate(by = list(.$GEOID), first) %>%
79 | select(GEOID, NAME, REGION) %>%
80 | mutate(REGION = factor(REGION, labels = c("West"))) %>%
81 | mutate(AREA = units::set_units(st_area(.), km^2)) %>%
82 | left_join(., total_pop_10, by = "GEOID") %>%
83 | left_join(., total_pop_15, by = "GEOID") %>%
84 | st_transform(3467)
85 |
86 | save(alaska, file = "data/alaska.rda", compress = "bzip2")
87 |
88 | # non-spatial data --------------------------------------------------------
89 | # B06011_001E - Median income in the past 12 months --!!Total:
90 | median_income_10 = get_acs(geography = "state", variables = "B06011_001E", endyear = 2010) %>%
91 | select(NAME, median_income_10 = estimate)
92 | median_income_15 = get_acs(geography = "state", variables = "B06011_001E", endyear = 2015) %>%
93 | select(NAME, median_income_15 = estimate)
94 | # B17001_002E - Income in the past 12 months below poverty level:
95 | poverty_level_10 = get_acs(geography = "state", variables = "B17001_002E", endyear = 2010) %>%
96 | select(NAME, poverty_level_10 = estimate)
97 | poverty_level_15 = get_acs(geography = "state", variables = "B17001_002E", endyear = 2015) %>%
98 | select(NAME, poverty_level_15 = estimate)
99 |
100 | us_state_eco = median_income_10 %>%
101 | filter(NAME != "Puerto Rico") %>%
102 | left_join(median_income_15, by = "NAME") %>%
103 | left_join(poverty_level_10, by = "NAME") %>%
104 | left_join(poverty_level_15, by = "NAME") %>%
105 | rename(state = NAME)
106 |
107 | us_states_df = us_state_eco
108 | save(us_states_df, file = "data/us_states_df.rda")
--------------------------------------------------------------------------------
/data-raw/rgdal_read_tests.R:
--------------------------------------------------------------------------------
1 | library(rgdal)
2 |
3 | auckland = readOGR("inst/shapes/auckland.shp")
4 | baltim = readOGR("inst/shapes/baltim.shp")
5 | boston_tracts = readOGR("inst/shapes/boston_tracts.shp")
6 | mapview::mapview(boston_tracts)
7 | columbus = readOGR("inst/shapes/columbus.shp")
8 | cycle_hire = readOGR("inst/shapes/cycle_hire.geojson")
9 | mapview::mapview(cycle_hire)
10 | cycle_hire_osm = readOGR("inst/shapes/cycle_hire_osm.geojson")
11 | mapview::mapview(cycle_hire_osm)
12 | eire = readOGR("inst/shapes/eire.shp")
13 | NY8_bna_utm18 = readOGR("inst/shapes/NY8_bna_utm18.gpkg")
14 | mapview::mapview(NY8_bna_utm18)
15 | NY8_utm18 = readOGR("inst/shapes/NY8_utm18.shp")
16 | mapview::mapview(NY8_utm18)
17 | sids = readOGR("inst/shapes/sids.shp")
18 | wheat = readOGR("inst/shapes/wheat.shp")
19 | world1 = readOGR("inst/shapes/world.gpkg")
20 | world2 = readOGR("inst/shapes/world.shp")
21 | mapview::mapview(world1)
22 | mapview::mapview(world2)
23 |
--------------------------------------------------------------------------------
/data-raw/save_externally.R:
--------------------------------------------------------------------------------
1 | library(purrr)
2 | rda2list = function(file) {
3 | e = new.env()
4 | load(file, envir = e)
5 | li = list(as.list(e))
6 | names(li) = tools::file_path_sans_ext(basename(file))
7 | return(li)
8 | }
9 |
10 | single_saver = function(x, filepath){
11 | print(filepath)
12 | if (inherits(x, "sf")){
13 | sf::write_sf(x, paste0(filepath, ".gpkg"))
14 | } else if (inherits(x, "sp")) {
15 | sf::write_sf(st_as_sf(x), paste0(filepath, ".gpkg"))
16 | } else if (inherits(x, "data.frame") || inherits(x, "matrix") || inherits(x, "numeric")) {
17 | write.csv(x, paste0(filepath, ".csv"), row.names = FALSE)
18 | } else if (inherits(x, "nb") && !inherits(x, "listw")){
19 | spdep::write.nb.gal(x, paste0(filepath, ".gal"))
20 | }
21 | #
22 | # } else if (inherits(x, "matrix"))
23 | }
24 |
25 | saver = function(x, outdir){
26 | for (i in seq_along(x)){
27 | name = names(x)[i]
28 | switch_name = switch (name,
29 | "aggregating_zones_aggregating_zones" = "aggregating_zones",
30 | "coffee_data_coffee_data" = "coffee_data",
31 | "cycle_hire_osm_cycle_hire_osm" = "cycle_hire_osm",
32 | "cycle_hire_cycle_hire" = "cycle_hire",
33 | "nc.sids_nc.sids" = "nc.sids",
34 | "nz_height_nz_height" = "nz_height",
35 | "urban_agglomerations_urban_agglomerations" = "urban_agglomerations",
36 | "us_states_df_us_states_df" = "us_states_df",
37 | "us_states_us_states" = "us_states",
38 | "used.cars_used.cars" = "used.cars",
39 | "worldbank_df_worldbank_df" = "worldbank_df"
40 | )
41 | if (!is.null(switch_name)) name = switch_name
42 | name_parts = strsplit(name, "[_\\.]")[[1]]
43 | if (length(name_parts) > 1 && name_parts[1] == name_parts[2]) {
44 | name = paste0(name_parts[1], "", tools::file_ext(name))
45 | }
46 | single_saver(x[[i]], paste0(outdir, "/", name))
47 | }
48 | }
49 |
50 | dir.create("../spData_files/data", showWarnings = FALSE)
51 | dir("data", full.names = TRUE) |>
52 | lapply(rda2list) |>
53 | lapply(list_flatten, name_repair = "minimal") |>
54 | list_flatten() |>
55 | saver("../spData_files/data")
56 |
57 | ext_files = c(
58 | dir("inst/misc", full.names = TRUE),
59 | dir("inst/raster", full.names = TRUE),
60 | dir("inst/weights", full.names = TRUE),
61 | dir("inst/shapes", full.names = TRUE, pattern = "*.(gpkg|geojson)")
62 | )
63 |
64 | file.copy(ext_files, "../spData_files/data/", overwrite = FALSE)
65 |
--------------------------------------------------------------------------------
/data-raw/update-world.R:
--------------------------------------------------------------------------------
1 | # Aim: update 'world' object
2 |
3 | # Load libraries
4 | library(mapedit)
5 | world = spData::world
6 | names(world)
7 | sf::st_geometry_type(world$geom) |> table()
8 |
9 | # Test 1: Edit all of the features (too slow)
10 | # world2 = mapedit::editFeatures(world)
11 |
12 | ukraine = world |>
13 | subset(grepl("Ukraine", name_long))
14 |
15 | russia = world |>
16 | subset(grepl("Russia", name_long))
17 |
18 | russia_polygons = russia |>
19 | sf::st_cast("POLYGON")
20 | crimea_centroid = tmaptools::geocode_OSM("Crimea", as.sf = TRUE)
21 | crimea_polygon = russia_polygons[crimea_centroid, ]
22 | plot(crimea_polygon)
23 |
24 | russia_updated = sf::st_difference(russia_polygons, crimea_polygon)
25 | mapview::mapview(russia_updated)
26 | russia_updated_union = sf::st_union(russia_updated)
27 | sf::st_geometry_type(russia_updated_union)
28 |
29 | ukraine_updated = sf::st_union(ukraine, crimea_polygon) |>
30 | sf::st_cast("MULTIPOLYGON")
31 | mapview::mapview(ukraine_updated)
32 | sf::st_geometry_type(ukraine_updated)
33 |
34 | sf::st_geometry_type(world$geom) |> table() # All MultiPolygon
35 |
36 | world$geom[grepl("Russia", world$name_long)] = russia_updated_union
37 | # Update Ukraine:
38 | world$geom[grepl("Ukraine", world$name_long)] = ukraine_updated$geom
39 | mapview::mapview(world)
40 |
41 | waldo::compare(spData::world, world)
42 | usethis::use_data(world, overwrite = TRUE)
43 |
44 | # Test world object
45 | devtools::load_all()
46 | mapview::mapview(world)
47 |
48 | write_sf(world, "inst/shapes/world.gpkg")
49 | write_sf(world, "inst/shapes/world.shp")
50 |
--------------------------------------------------------------------------------
/data-raw/updates_nz_crs.R:
--------------------------------------------------------------------------------
1 | library(spData)
2 | library(sf)
3 | st_crs(nz) = "EPSG:2193"
4 | st_crs(nz_height) = "EPSG:2193"
5 | usethis::use_data(nz, overwrite = TRUE)
6 | usethis::use_data(nz_height, overwrite = TRUE)
7 |
--------------------------------------------------------------------------------
/data-raw/world.R:
--------------------------------------------------------------------------------
1 | # install.packages("wbstats")
2 | # devtools::install_github("ropenscilabs/rnaturalearth")
3 | library(wbstats)
4 | library(rnaturalearth)
5 | library(dplyr)
6 | library(tidyr)
7 | library(sf)
8 |
9 | # query_lifeexp = wbsearch(pattern = "life expectancy")
10 | # query_gdp = wbsearch("GDP")
11 |
12 | wb_data_create = function(indicator, our_name, year, ...){
13 | df = wb(indicator = indicator, startdate = year, enddate = year, ...) %>%
14 | as_data_frame() %>%
15 | select(iso_a2=iso2c, value) %>%
16 | mutate(indicator = our_name) %>%
17 | spread(indicator, value)
18 | return(df)
19 | }
20 |
21 | ## IMPORTANT - repeat if a server is down
22 |
23 | data_pop = wb_data_create(indicator = "SP.POP.TOTL", our_name = "pop",
24 | year = 2014, country = "countries_only")
25 | data_lifeexp = wb_data_create(indicator = "SP.DYN.LE00.IN", our_name = "lifeExp",
26 | year = 2014, country = "countries_only")
27 | data_gdp = wb_data_create("NY.GDP.PCAP.PP.KD", our_name = "gdpPercap",
28 | year = 2014, country = "countries_only")
29 |
30 | world = ne_countries(returnclass = "sf") %>%
31 | left_join(., data_pop, by = c("iso_a2")) %>%
32 | left_join(., data_lifeexp, by = c("iso_a2")) %>%
33 | left_join(., data_gdp, by = c("iso_a2")) %>%
34 | mutate(area_km2 = raster::area(as(., "Spatial")) / 1000000) %>%
35 | select(iso_a2, name_long, continent, region_un, subregion,
36 | type, area_km2, pop, lifeExp, gdpPercap)
37 |
38 | usethis::use_data(world)
39 |
40 | # fix world (post sf 1.0.0)
41 | library(sf)
42 | library(s2)
43 | library(giscoR)
44 | data("world", package = "spData")
45 | sf_use_s2(FALSE)
46 |
47 | bb = st_bbox(giscoR::gisco_get_countries())
48 | world2 = st_intersection(world, st_as_sfc(bb))
49 |
50 | sf_use_s2(TRUE)
51 | world2$geom = s2::as_s2_geography(world2$geom, check = FALSE)
52 | world2$geom = s2::s2_union(world2$geom)
53 | world2$geom = s2::s2_rebuild(world2$geom, s2::s2_options(split_crossing_edges = TRUE))
54 | world2$geom = st_as_sfc(world2$geom)
55 |
56 | # isv = sf::st_is_valid(world2)
57 | # world2$name_long[!isv]
58 | world = world2
59 | usethis::use_data(world, overwrite = TRUE)
60 | write_sf(world, "inst/shapes/world.gpkg")
61 | write_sf(world, "inst/shapes/world.shp")
62 |
--------------------------------------------------------------------------------
/data/SplashDams.rda:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Nowosad/spData/eeb5d38f3dfd9a4abd100c5c564a6801e0d0a80c/data/SplashDams.rda
--------------------------------------------------------------------------------
/data/afcon.rda:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Nowosad/spData/eeb5d38f3dfd9a4abd100c5c564a6801e0d0a80c/data/afcon.rda
--------------------------------------------------------------------------------
/data/aggregating_zones.rda:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Nowosad/spData/eeb5d38f3dfd9a4abd100c5c564a6801e0d0a80c/data/aggregating_zones.rda
--------------------------------------------------------------------------------
/data/alaska.rda:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Nowosad/spData/eeb5d38f3dfd9a4abd100c5c564a6801e0d0a80c/data/alaska.rda
--------------------------------------------------------------------------------
/data/auckland.rda:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Nowosad/spData/eeb5d38f3dfd9a4abd100c5c564a6801e0d0a80c/data/auckland.rda
--------------------------------------------------------------------------------
/data/baltimore.rda:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Nowosad/spData/eeb5d38f3dfd9a4abd100c5c564a6801e0d0a80c/data/baltimore.rda
--------------------------------------------------------------------------------
/data/boston.rda:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Nowosad/spData/eeb5d38f3dfd9a4abd100c5c564a6801e0d0a80c/data/boston.rda
--------------------------------------------------------------------------------
/data/coffee_data.rda:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Nowosad/spData/eeb5d38f3dfd9a4abd100c5c564a6801e0d0a80c/data/coffee_data.rda
--------------------------------------------------------------------------------
/data/columbus.rda:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Nowosad/spData/eeb5d38f3dfd9a4abd100c5c564a6801e0d0a80c/data/columbus.rda
--------------------------------------------------------------------------------
/data/congruent.rda:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Nowosad/spData/eeb5d38f3dfd9a4abd100c5c564a6801e0d0a80c/data/congruent.rda
--------------------------------------------------------------------------------
/data/cycle_hire.rda:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Nowosad/spData/eeb5d38f3dfd9a4abd100c5c564a6801e0d0a80c/data/cycle_hire.rda
--------------------------------------------------------------------------------
/data/cycle_hire_osm.rda:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Nowosad/spData/eeb5d38f3dfd9a4abd100c5c564a6801e0d0a80c/data/cycle_hire_osm.rda
--------------------------------------------------------------------------------
/data/depmunic.rda:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Nowosad/spData/eeb5d38f3dfd9a4abd100c5c564a6801e0d0a80c/data/depmunic.rda
--------------------------------------------------------------------------------
/data/eire.rda:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Nowosad/spData/eeb5d38f3dfd9a4abd100c5c564a6801e0d0a80c/data/eire.rda
--------------------------------------------------------------------------------
/data/elect80.rda:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Nowosad/spData/eeb5d38f3dfd9a4abd100c5c564a6801e0d0a80c/data/elect80.rda
--------------------------------------------------------------------------------
/data/getisord.rda:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Nowosad/spData/eeb5d38f3dfd9a4abd100c5c564a6801e0d0a80c/data/getisord.rda
--------------------------------------------------------------------------------
/data/hawaii.rda:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Nowosad/spData/eeb5d38f3dfd9a4abd100c5c564a6801e0d0a80c/data/hawaii.rda
--------------------------------------------------------------------------------
/data/hopkins.rda:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Nowosad/spData/eeb5d38f3dfd9a4abd100c5c564a6801e0d0a80c/data/hopkins.rda
--------------------------------------------------------------------------------
/data/house.rda:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Nowosad/spData/eeb5d38f3dfd9a4abd100c5c564a6801e0d0a80c/data/house.rda
--------------------------------------------------------------------------------
/data/huddersfield.rda:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Nowosad/spData/eeb5d38f3dfd9a4abd100c5c564a6801e0d0a80c/data/huddersfield.rda
--------------------------------------------------------------------------------
/data/incongruent.rda:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Nowosad/spData/eeb5d38f3dfd9a4abd100c5c564a6801e0d0a80c/data/incongruent.rda
--------------------------------------------------------------------------------
/data/jenks71.rda:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Nowosad/spData/eeb5d38f3dfd9a4abd100c5c564a6801e0d0a80c/data/jenks71.rda
--------------------------------------------------------------------------------
/data/lnd.rda:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Nowosad/spData/eeb5d38f3dfd9a4abd100c5c564a6801e0d0a80c/data/lnd.rda
--------------------------------------------------------------------------------
/data/nc.sids.rda:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Nowosad/spData/eeb5d38f3dfd9a4abd100c5c564a6801e0d0a80c/data/nc.sids.rda
--------------------------------------------------------------------------------
/data/nydata.rda:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Nowosad/spData/eeb5d38f3dfd9a4abd100c5c564a6801e0d0a80c/data/nydata.rda
--------------------------------------------------------------------------------
/data/nz.rda:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Nowosad/spData/eeb5d38f3dfd9a4abd100c5c564a6801e0d0a80c/data/nz.rda
--------------------------------------------------------------------------------
/data/nz_height.rda:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Nowosad/spData/eeb5d38f3dfd9a4abd100c5c564a6801e0d0a80c/data/nz_height.rda
--------------------------------------------------------------------------------
/data/properties.rda:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Nowosad/spData/eeb5d38f3dfd9a4abd100c5c564a6801e0d0a80c/data/properties.rda
--------------------------------------------------------------------------------
/data/seine.rda:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Nowosad/spData/eeb5d38f3dfd9a4abd100c5c564a6801e0d0a80c/data/seine.rda
--------------------------------------------------------------------------------
/data/state.vbm.rda:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Nowosad/spData/eeb5d38f3dfd9a4abd100c5c564a6801e0d0a80c/data/state.vbm.rda
--------------------------------------------------------------------------------
/data/urban_agglomerations.rda:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Nowosad/spData/eeb5d38f3dfd9a4abd100c5c564a6801e0d0a80c/data/urban_agglomerations.rda
--------------------------------------------------------------------------------
/data/us_states.rda:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Nowosad/spData/eeb5d38f3dfd9a4abd100c5c564a6801e0d0a80c/data/us_states.rda
--------------------------------------------------------------------------------
/data/us_states_df.rda:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Nowosad/spData/eeb5d38f3dfd9a4abd100c5c564a6801e0d0a80c/data/us_states_df.rda
--------------------------------------------------------------------------------
/data/used.cars.rda:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Nowosad/spData/eeb5d38f3dfd9a4abd100c5c564a6801e0d0a80c/data/used.cars.rda
--------------------------------------------------------------------------------
/data/wheat.rda:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Nowosad/spData/eeb5d38f3dfd9a4abd100c5c564a6801e0d0a80c/data/wheat.rda
--------------------------------------------------------------------------------
/data/world.rda:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Nowosad/spData/eeb5d38f3dfd9a4abd100c5c564a6801e0d0a80c/data/world.rda
--------------------------------------------------------------------------------
/data/worldbank_df.rda:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Nowosad/spData/eeb5d38f3dfd9a4abd100c5c564a6801e0d0a80c/data/worldbank_df.rda
--------------------------------------------------------------------------------
/inst/README:
--------------------------------------------------------------------------------
1 | This file is intended to clarify ownership and copyright: where
2 | possible individual files also carry brief copyright notices.
3 |
4 | Copyrights
5 | ==========
6 |
7 | Files: inst/shapes/baltim.*, inst/shapes/columbus.*, and inst/shapes/sids.*
8 | are derived by permission from SAL data files
9 | prepared by Luc Anselin; they were downloaded from:
10 |
11 | http://geodacenter.asu.edu/sdata
12 |
13 | under the following conditions: "The data are provided as is, without
14 | any warranties. Please make sure to give proper credit when using
15 | them in any publications. Some of the data sets are purely illustrative
16 | and should not be used for substantive research."
17 |
18 | ***********************
19 |
20 | Files: data/afcon.rda, data/columbus.rda, data/nc.sids.rda
21 | are derived by permission from SpaceStat data files
22 | prepared by Luc Anselin; they were downloaded from:
23 |
24 | http://www.spacestat.com/data.htm#data
25 |
26 | under the following conditions: "All data sets are provided as is,
27 | and no warranties, expressed or implied are made as to the correctness
28 | and fitness for a purpose. Proper citation of the source of the data in
29 | published work would be appreciated."
30 |
31 | File: data/eire.rda is derived from data sets made available by Michael
32 | Tiefelsdorf based on sources named in man/eire.Rd, and downloaded from:
33 |
34 | http://geog-www.sbs.ohio-state.edu/faculty/tiefelsdorf/GeoStat.htm
35 |
36 | File: data/auckland.rda is derived from data sets included with INFOMAP
37 | in Bailey T, Gatrell A (1995) Interactive Spatial Data Analysis, Harlow:
38 | Longman, and is used with permission of the authors.
39 |
40 | File: data/NY_data.rda is derived from data sets for Waller, L. and
41 | C. Gotway (2004) Applied Spatial Statistics for Public Health Data,
42 | New York: John Wiley and Sons, and is used with permission of the authors.
43 |
44 | Other files in the data directory are derived from sources given on
45 | their help pages.
46 |
47 |
48 |
--------------------------------------------------------------------------------
/inst/misc/nydata.dbf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Nowosad/spData/eeb5d38f3dfd9a4abd100c5c564a6801e0d0a80c/inst/misc/nydata.dbf
--------------------------------------------------------------------------------
/inst/raster/elev.tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Nowosad/spData/eeb5d38f3dfd9a4abd100c5c564a6801e0d0a80c/inst/raster/elev.tif
--------------------------------------------------------------------------------
/inst/raster/grain.tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Nowosad/spData/eeb5d38f3dfd9a4abd100c5c564a6801e0d0a80c/inst/raster/grain.tif
--------------------------------------------------------------------------------
/inst/raster/grain.tif.aux.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | grain
4 |
5 | clay
6 | silt
7 | sand
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/inst/shapes/NY8_bna_utm18.gpkg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Nowosad/spData/eeb5d38f3dfd9a4abd100c5c564a6801e0d0a80c/inst/shapes/NY8_bna_utm18.gpkg
--------------------------------------------------------------------------------
/inst/shapes/NY8_utm18.gpkg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Nowosad/spData/eeb5d38f3dfd9a4abd100c5c564a6801e0d0a80c/inst/shapes/NY8_utm18.gpkg
--------------------------------------------------------------------------------
/inst/shapes/auckland.gpkg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Nowosad/spData/eeb5d38f3dfd9a4abd100c5c564a6801e0d0a80c/inst/shapes/auckland.gpkg
--------------------------------------------------------------------------------
/inst/shapes/boston_tracts.gpkg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Nowosad/spData/eeb5d38f3dfd9a4abd100c5c564a6801e0d0a80c/inst/shapes/boston_tracts.gpkg
--------------------------------------------------------------------------------
/inst/shapes/columbus.gpkg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Nowosad/spData/eeb5d38f3dfd9a4abd100c5c564a6801e0d0a80c/inst/shapes/columbus.gpkg
--------------------------------------------------------------------------------
/inst/shapes/eire.gpkg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Nowosad/spData/eeb5d38f3dfd9a4abd100c5c564a6801e0d0a80c/inst/shapes/eire.gpkg
--------------------------------------------------------------------------------
/inst/shapes/sids.gpkg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Nowosad/spData/eeb5d38f3dfd9a4abd100c5c564a6801e0d0a80c/inst/shapes/sids.gpkg
--------------------------------------------------------------------------------
/inst/shapes/wheat.gpkg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Nowosad/spData/eeb5d38f3dfd9a4abd100c5c564a6801e0d0a80c/inst/shapes/wheat.gpkg
--------------------------------------------------------------------------------
/inst/shapes/world.gpkg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Nowosad/spData/eeb5d38f3dfd9a4abd100c5c564a6801e0d0a80c/inst/shapes/world.gpkg
--------------------------------------------------------------------------------
/inst/weights/NY_nb.gal:
--------------------------------------------------------------------------------
1 | 281
2 | 0 8
3 | 1 12 13 14 46 47 48 49
4 | 1 6
5 | 0 2 12 34 46 47
6 | 2 3
7 | 1 12 34
8 | 3 3
9 | 4 5 34
10 | 4 4
11 | 3 5 9 11
12 | 5 5
13 | 3 4 6 9 34
14 | 6 4
15 | 5 7 31 34
16 | 7 2
17 | 6 31
18 | 8 4
19 | 16 17 32 33
20 | 9 4
21 | 4 5 10 11
22 | 10 2
23 | 9 11
24 | 11 3
25 | 4 9 10
26 | 12 4
27 | 0 1 2 13
28 | 13 3
29 | 0 12 14
30 | 14 4
31 | 0 13 15 49
32 | 15 5
33 | 14 16 33 49 51
34 | 16 4
35 | 8 15 17 33
36 | 17 3
37 | 8 16 33
38 | 18 6
39 | 19 20 21 80 81 82
40 | 19 7
41 | 18 20 21 22 23 25 81
42 | 20 7
43 | 18 19 21 82 89 90 251
44 | 21 5
45 | 18 19 20 22 251
46 | 22 7
47 | 19 21 25 35 41 251 253
48 | 23 4
49 | 19 24 25 27
50 | 24 2
51 | 23 25
52 | 25 6
53 | 19 22 23 24 34 35
54 | 26 3
55 | 27 31 34
56 | 27 5
57 | 23 26 28 31 81
58 | 28 5
59 | 27 29 30 31 81
60 | 29 3
61 | 28 30 81
62 | 30 3
63 | 28 29 31
64 | 31 7
65 | 6 7 26 27 28 30 34
66 | 32 2
67 | 8 33
68 | 33 7
69 | 8 15 16 17 32 51 54
70 | 34 11
71 | 1 2 3 5 6 25 26 31 35 46 50
72 | 35 6
73 | 22 25 34 36 41 50
74 | 36 9
75 | 35 37 38 39 41 47 49 50 51
76 | 37 5
77 | 36 38 42 43 45
78 | 38 5
79 | 36 37 39 41 42
80 | 39 3
81 | 36 38 41
82 | 40 4
83 | 41 44 45 253
84 | 41 9
85 | 22 35 36 38 39 40 42 44 253
86 | 42 5
87 | 37 38 41 43 44
88 | 43 4
89 | 37 42 44 45
90 | 44 5
91 | 40 41 42 43 45
92 | 45 5
93 | 37 40 43 44 53
94 | 46 5
95 | 0 1 34 47 50
96 | 47 7
97 | 0 1 36 46 48 49 50
98 | 48 3
99 | 0 47 49
100 | 49 7
101 | 0 14 15 36 47 48 51
102 | 50 5
103 | 34 35 36 46 47
104 | 51 6
105 | 15 33 36 49 52 54
106 | 52 3
107 | 51 53 54
108 | 53 4
109 | 45 52 54 254
110 | 54 5
111 | 33 51 52 53 254
112 | 55 1
113 | 56
114 | 56 5
115 | 55 57 58 65 191
116 | 57 5
117 | 56 58 60 65 191
118 | 58 3
119 | 56 57 59
120 | 59 4
121 | 58 60 61 65
122 | 60 4
123 | 57 59 61 197
124 | 61 9
125 | 59 60 62 63 64 65 66 197 246
126 | 62 6
127 | 61 65 66 68 69 246
128 | 63 3
129 | 61 64 66
130 | 64 4
131 | 61 63 65 66
132 | 65 9
133 | 56 57 59 61 62 64 66 67 68
134 | 66 5
135 | 61 62 63 64 65
136 | 67 3
137 | 65 68 72
138 | 68 5
139 | 62 65 67 71 72
140 | 69 5
141 | 62 70 71 84 246
142 | 70 6
143 | 69 71 84 85 258 259
144 | 71 5
145 | 68 69 70 72 259
146 | 72 4
147 | 67 68 71 259
148 | 73 6
149 | 74 77 78 105 107 108
150 | 74 5
151 | 73 78 79 82 105
152 | 75 3
153 | 76 77 78
154 | 76 3
155 | 75 77 78
156 | 77 4
157 | 73 75 76 78
158 | 78 7
159 | 73 74 75 76 77 79 80
160 | 79 4
161 | 74 78 80 82
162 | 80 5
163 | 18 78 79 81 82
164 | 81 6
165 | 18 19 27 28 29 80
166 | 82 11
167 | 18 20 74 79 80 83 88 89 105 249 250
168 | 83 5
169 | 82 84 86 88 249
170 | 84 7
171 | 69 70 83 85 86 247 249
172 | 85 7
173 | 70 84 86 87 90 91 258
174 | 86 5
175 | 83 84 85 87 88
176 | 87 4
177 | 85 86 88 90
178 | 88 6
179 | 82 83 86 87 89 90
180 | 89 4
181 | 20 82 88 90
182 | 90 8
183 | 20 85 87 88 89 91 92 251
184 | 91 4
185 | 85 90 92 258
186 | 92 6
187 | 90 91 251 258 276 277
188 | 93 2
189 | 94 95
190 | 94 2
191 | 93 95
192 | 95 4
193 | 93 94 96 103
194 | 96 5
195 | 95 97 98 99 103
196 | 97 1
197 | 96
198 | 98 5
199 | 96 99 172 175 234
200 | 99 7
201 | 96 98 100 102 103 231 234
202 | 100 1
203 | 99
204 | 101 1
205 | 102
206 | 102 8
207 | 99 101 103 104 105 231 235 250
208 | 103 6
209 | 95 96 99 102 104 107
210 | 104 5
211 | 102 103 105 106 107
212 | 105 8
213 | 73 74 82 102 104 106 107 250
214 | 106 3
215 | 104 105 107
216 | 107 6
217 | 73 103 104 105 106 108
218 | 108 2
219 | 73 107
220 | 109 8
221 | 110 113 119 129 130 205 214 218
222 | 110 6
223 | 109 111 112 113 114 218
224 | 111 4
225 | 110 112 218 219
226 | 112 8
227 | 110 111 114 115 116 117 118 219
228 | 113 7
229 | 109 110 114 119 120 121 122
230 | 114 5
231 | 110 112 113 115 122
232 | 115 4
233 | 112 114 116 122
234 | 116 5
235 | 112 115 117 122 123
236 | 117 8
237 | 112 116 118 123 124 125 126 219
238 | 118 7
239 | 112 117 126 127 128 219 221
240 | 119 5
241 | 109 113 120 130 131
242 | 120 7
243 | 113 119 121 130 131 132 138
244 | 121 5
245 | 113 120 122 123 132
246 | 122 7
247 | 113 114 115 116 121 123 132
248 | 123 6
249 | 116 117 121 122 124 132
250 | 124 6
251 | 117 123 125 132 133 140
252 | 125 6
253 | 117 124 126 133 141 142
254 | 126 6
255 | 117 118 125 127 142 143
256 | 127 6
257 | 118 126 128 142 143 144
258 | 128 7
259 | 118 127 143 144 220 221 223
260 | 129 7
261 | 109 130 134 136 205 206 207
262 | 130 7
263 | 109 119 120 129 131 136 137
264 | 131 6
265 | 119 120 130 136 137 138
266 | 132 8
267 | 120 121 122 123 124 138 139 140
268 | 133 4
269 | 124 125 140 141
270 | 134 5
271 | 129 135 136 207 209
272 | 135 5
273 | 134 136 145 207 209
274 | 136 9
275 | 129 130 131 134 135 137 145 146 148
276 | 137 6
277 | 130 131 136 138 146 148
278 | 138 8
279 | 120 131 132 137 139 148 149 150
280 | 139 6
281 | 132 138 140 149 150 151
282 | 140 6
283 | 124 132 133 139 141 151
284 | 141 6
285 | 125 133 140 142 151 152
286 | 142 8
287 | 125 126 127 141 143 152 153 154
288 | 143 6
289 | 126 127 128 142 144 154
290 | 144 6
291 | 127 128 143 154 220 223
292 | 145 5
293 | 135 136 146 155 209
294 | 146 8
295 | 136 137 145 147 148 155 156 157
296 | 147 6
297 | 146 148 149 156 157 159
298 | 148 6
299 | 136 137 138 146 147 149
300 | 149 7
301 | 138 139 147 148 150 159 160
302 | 150 5
303 | 138 139 149 151 160
304 | 151 7
305 | 139 140 141 150 152 160 162
306 | 152 6
307 | 141 142 151 153 162 163
308 | 153 4
309 | 142 152 154 163
310 | 154 7
311 | 142 143 144 153 163 223 224
312 | 155 6
313 | 145 146 156 209 241 242
314 | 156 6
315 | 146 147 155 157 165 241
316 | 157 6
317 | 146 147 156 158 159 165
318 | 158 4
319 | 157 159 165 166
320 | 159 6
321 | 147 149 157 158 160 166
322 | 160 7
323 | 149 150 151 159 161 162 166
324 | 161 4
325 | 160 162 166 167
326 | 162 9
327 | 151 152 160 161 163 167 169 170 239
328 | 163 7
329 | 152 153 154 162 164 224 239
330 | 164 3
331 | 163 224 239
332 | 165 6
333 | 156 157 158 166 168 241
334 | 166 8
335 | 158 159 160 161 165 167 168 169
336 | 167 5
337 | 161 162 166 168 169
338 | 168 7
339 | 165 166 167 169 171 240 241
340 | 169 6
341 | 162 166 167 168 170 171
342 | 170 5
343 | 162 169 171 239 240
344 | 171 5
345 | 168 169 170 239 240
346 | 172 4
347 | 98 173 174 175
348 | 173 3
349 | 172 174 189
350 | 174 7
351 | 172 173 175 176 182 188 189
352 | 175 8
353 | 98 172 174 176 177 221 222 234
354 | 176 5
355 | 174 175 177 178 182
356 | 177 7
357 | 175 176 178 179 180 216 221
358 | 178 4
359 | 176 177 179 182
360 | 179 4
361 | 177 178 180 182
362 | 180 7
363 | 177 179 181 182 212 215 216
364 | 181 5
365 | 180 182 184 212 215
366 | 182 9
367 | 174 176 178 179 180 181 184 187 188
368 | 183 4
369 | 184 185 187 211
370 | 184 6
371 | 181 182 183 187 211 212
372 | 185 4
373 | 183 186 187 189
374 | 186 3
375 | 185 187 189
376 | 187 7
377 | 182 183 184 185 186 188 189
378 | 188 4
379 | 174 182 187 189
380 | 189 6
381 | 173 174 185 186 187 188
382 | 190 3
383 | 191 192 193
384 | 191 5
385 | 56 57 190 193 196
386 | 192 3
387 | 190 193 211
388 | 193 3
389 | 190 191 192
390 | 194 2
391 | 195 196
392 | 195 4
393 | 194 196 198 205
394 | 196 5
395 | 191 194 195 197 198
396 | 197 5
397 | 60 61 196 198 246
398 | 198 10
399 | 195 196 197 199 200 201 204 205 243 246
400 | 199 3
401 | 198 200 201
402 | 200 8
403 | 198 199 201 202 203 238 242 243
404 | 201 5
405 | 198 199 200 202 204
406 | 202 4
407 | 200 201 203 204
408 | 203 5
409 | 200 202 204 208 242
410 | 204 8
411 | 198 201 202 203 205 206 207 208
412 | 205 6
413 | 109 129 195 198 204 206
414 | 206 4
415 | 129 204 205 207
416 | 207 7
417 | 129 134 135 204 206 208 209
418 | 208 5
419 | 203 204 207 209 242
420 | 209 7
421 | 134 135 145 155 207 208 242
422 | 210 3
423 | 211 212 213
424 | 211 5
425 | 183 184 192 210 212
426 | 212 9
427 | 180 181 184 210 211 213 214 215 218
428 | 213 3
429 | 210 212 214
430 | 214 5
431 | 109 212 213 215 218
432 | 215 7
433 | 180 181 212 214 216 217 218
434 | 216 5
435 | 177 180 215 217 221
436 | 217 5
437 | 215 216 218 219 221
438 | 218 8
439 | 109 110 111 212 214 215 217 219
440 | 219 7
441 | 111 112 117 118 217 218 221
442 | 220 5
443 | 128 144 221 222 223
444 | 221 9
445 | 118 128 175 177 216 217 219 220 222
446 | 222 6
447 | 175 220 221 223 233 234
448 | 223 9
449 | 128 144 154 220 222 224 225 228 233
450 | 224 7
451 | 154 163 164 223 225 226 239
452 | 225 6
453 | 223 224 226 228 229 233
454 | 226 6
455 | 224 225 229 235 236 239
456 | 227 2
457 | 228 231
458 | 228 8
459 | 223 225 227 229 230 231 233 234
460 | 229 6
461 | 225 226 228 230 231 235
462 | 230 2
463 | 228 229
464 | 231 7
465 | 99 102 227 228 229 234 235
466 | 232 2
467 | 233 234
468 | 233 6
469 | 222 223 225 228 232 234
470 | 234 8
471 | 98 99 175 222 228 231 232 233
472 | 235 6
473 | 102 226 229 231 236 250
474 | 236 8
475 | 226 235 237 238 239 248 249 250
476 | 237 5
477 | 236 238 239 240 241
478 | 238 7
479 | 200 236 237 241 242 243 248
480 | 239 10
481 | 162 163 164 170 171 224 226 236 237 240
482 | 240 6
483 | 168 170 171 237 239 241
484 | 241 8
485 | 155 156 165 168 237 238 240 242
486 | 242 7
487 | 155 200 203 208 209 238 241
488 | 243 7
489 | 198 200 238 244 246 247 248
490 | 244 1
491 | 243
492 | 245 1
493 | 246
494 | 246 8
495 | 61 62 69 197 198 243 245 247
496 | 247 5
497 | 84 243 246 248 249
498 | 248 5
499 | 236 238 243 247 249
500 | 249 7
501 | 82 83 84 236 247 248 250
502 | 250 6
503 | 82 102 105 235 236 249
504 | 251 8
505 | 20 21 22 90 92 252 253 277
506 | 252 5
507 | 251 253 256 257 277
508 | 253 7
509 | 22 40 41 251 252 255 256
510 | 254 4
511 | 53 54 255 256
512 | 255 3
513 | 253 254 256
514 | 256 5
515 | 252 253 254 255 257
516 | 257 4
517 | 252 256 277 278
518 | 258 6
519 | 70 85 91 92 259 276
520 | 259 7
521 | 70 71 72 258 260 261 276
522 | 260 5
523 | 259 261 276 279 280
524 | 261 4
525 | 259 260 264 279
526 | 262 3
527 | 263 271 278
528 | 263 5
529 | 262 264 267 270 271
530 | 264 7
531 | 261 263 265 266 267 279 280
532 | 265 4
533 | 264 266 275 280
534 | 266 7
535 | 264 265 267 268 272 274 275
536 | 267 6
537 | 263 264 266 268 269 270
538 | 268 4
539 | 266 267 269 272
540 | 269 5
541 | 267 268 270 271 272
542 | 270 5
543 | 263 267 269 271 272
544 | 271 7
545 | 262 263 269 270 272 277 278
546 | 272 8
547 | 266 268 269 270 271 273 274 277
548 | 273 4
549 | 272 274 275 277
550 | 274 4
551 | 266 272 273 275
552 | 275 7
553 | 265 266 273 274 276 277 280
554 | 276 7
555 | 92 258 259 260 275 277 280
556 | 277 10
557 | 92 251 252 257 271 272 273 275 276 278
558 | 278 4
559 | 257 262 271 277
560 | 279 4
561 | 260 261 264 280
562 | 280 6
563 | 260 264 265 275 276 279
564 |
--------------------------------------------------------------------------------
/inst/weights/columbus.gal:
--------------------------------------------------------------------------------
1 | 49
2 | 1 2
3 | 2 3
4 | 2 3
5 | 1 3 4
6 | 3 4
7 | 1 2 4 5
8 | 4 4
9 | 2 3 5 8
10 | 5 7
11 | 3 4 6 8 9 11 15
12 | 6 2
13 | 5 9
14 | 7 4
15 | 8 12 13 14
16 | 8 6
17 | 4 5 7 11 12 13
18 | 9 8
19 | 5 6 10 15 20 22 25 26
20 | 10 4
21 | 9 17 20 22
22 | 11 5
23 | 5 8 12 15 16
24 | 12 6
25 | 7 8 11 13 14 16
26 | 13 4
27 | 7 8 12 14
28 | 14 6
29 | 7 12 13 16 18 19
30 | 15 6
31 | 5 9 11 16 25 26
32 | 16 7
33 | 11 12 14 15 18 24 25
34 | 17 3
35 | 10 20 23
36 | 18 4
37 | 14 16 19 24
38 | 19 3
39 | 14 18 24
40 | 20 10
41 | 9 10 17 22 23 27 32 33 35 40
42 | 21 3
43 | 24 30 34
44 | 22 6
45 | 9 10 20 26 27 28
46 | 23 3
47 | 17 20 32
48 | 24 7
49 | 16 18 19 21 25 29 30
50 | 25 7
51 | 9 15 16 24 26 28 29
52 | 26 6
53 | 9 15 22 25 28 29
54 | 27 4
55 | 20 22 28 33
56 | 28 9
57 | 22 25 26 27 29 33 35 37 38
58 | 29 7
59 | 24 25 26 28 30 37 38
60 | 30 4
61 | 21 24 29 37
62 | 31 2
63 | 34 36
64 | 32 4
65 | 20 23 40 41
66 | 33 4
67 | 20 27 28 35
68 | 34 4
69 | 21 31 36 42
70 | 35 7
71 | 20 28 33 38 40 43 44
72 | 36 5
73 | 31 34 39 42 46
74 | 37 6
75 | 28 29 30 38 43 45
76 | 38 6
77 | 28 29 35 37 43 44
78 | 39 2
79 | 36 46
80 | 40 5
81 | 20 32 35 41 47
82 | 41 3
83 | 32 40 47
84 | 42 2
85 | 34 36
86 | 43 6
87 | 35 37 38 44 45 48
88 | 44 5
89 | 35 38 43 48 49
90 | 45 4
91 | 37 43 48 49
92 | 46 2
93 | 36 39
94 | 47 2
95 | 40 41
96 | 48 4
97 | 43 44 45 49
98 | 49 3
99 | 44 45 48
100 |
--------------------------------------------------------------------------------
/inst/weights/ncCC89.gal:
--------------------------------------------------------------------------------
1 | 0 100 sids rn
2 | 37001 5
3 | 37033 37037 37063 37081 37135
4 | 37003 4
5 | 37027 37035 37097 37193
6 | 37005 3
7 | 37009 37171 37193
8 | 37007 4
9 | 37123 37153 37167 37179
10 | 37009 3
11 | 37005 37189 37193
12 | 37011 6
13 | 37023 37027 37111 37121 37189 37199
14 | 37013 3
15 | 37117 37147 37187
16 | 37015 4
17 | 37041 37091 37117 37187
18 | 37017 2
19 | 37047 37155
20 | 37019 1
21 | 37129
22 | 37021 6
23 | 37087 37089 37111 37115 37175 37199
24 | 37023 6
25 | 37011 37027 37035 37111 37121 37161
26 | 37025 4
27 | 37119 37159 37167 37179
28 | 37027 7
29 | 37003 37011 37023 37035 37111 37189 37193
30 | 37029 4
31 | 37053 37139 37143 37177
32 | 37031 1
33 | 37137
34 | 37033 4
35 | 37001 37135 37145 37157
36 | 37035 6
37 | 37003 37023 37027 37071 37097 37109
38 | 37037 7
39 | 37001 37063 37085 37105 37125 37135 37183
40 | 37039 2
41 | 37043 37075
42 | 37041 8
43 | 37015 37073 37091 37117 37139 37143 37177 37187
44 | 37043 3
45 | 37039 37075 37113
46 | 37045 3
47 | 37071 37109 37161
48 | 37047 2
49 | 37017 37155
50 | 37049 2
51 | 37103 37137
52 | 37051 3
53 | 37085 37093 37163
54 | 37053 2
55 | 37029 37139
56 | 37055 0
57 |
58 | 37057 4
59 | 37059 37067 37151 37159
60 | 37059 5
61 | 37057 37067 37097 37159 37197
62 | 37061 2
63 | 37141 37163
64 | 37063 6
65 | 37001 37037 37077 37135 37145 37183
66 | 37065 5
67 | 37083 37117 37127 37147 37195
68 | 37067 5
69 | 37057 37059 37081 37169 37197
70 | 37069 5
71 | 37077 37127 37181 37183 37185
72 | 37071 4
73 | 37035 37045 37109 37119
74 | 37073 3
75 | 37041 37091 37143
76 | 37075 4
77 | 37039 37043 37113 37173
78 | 37077 5
79 | 37063 37069 37145 37181 37185
80 | 37079 4
81 | 37107 37147 37191 37195
82 | 37081 4
83 | 37001 37067 37151 37157
84 | 37083 2
85 | 37065 37131
86 | 37085 5
87 | 37037 37051 37101 37105 37183
88 | 37087 5
89 | 37021 37099 37115 37173 37175
90 | 37089 4
91 | 37021 37149 37161 37175
92 | 37091 5
93 | 37015 37041 37073 37131 37143
94 | 37093 4
95 | 37051 37125 37155 37165
96 | 37095 0
97 |
98 | 37097 7
99 | 37003 37035 37059 37109 37159 37193 37197
100 | 37099 4
101 | 37087 37113 37173 37175
102 | 37101 4
103 | 37085 37183 37191 37195
104 | 37103 3
105 | 37049 37107 37133
106 | 37105 3
107 | 37037 37085 37125
108 | 37107 4
109 | 37079 37103 37147 37191
110 | 37109 5
111 | 37035 37045 37071 37097 37119
112 | 37111 7
113 | 37011 37021 37023 37027 37121 37161 37199
114 | 37113 4
115 | 37043 37075 37099 37173
116 | 37115 3
117 | 37021 37087 37199
118 | 37117 6
119 | 37013 37015 37041 37065 37147 37187
120 | 37119 4
121 | 37025 37071 37109 37179
122 | 37121 5
123 | 37011 37023 37111 37189 37199
124 | 37123 4
125 | 37007 37125 37151 37167
126 | 37125 4
127 | 37037 37093 37105 37123
128 | 37127 3
129 | 37065 37069 37195
130 | 37129 2
131 | 37019 37141
132 | 37131 2
133 | 37083 37091
134 | 37133 1
135 | 37103
136 | 37135 5
137 | 37001 37033 37037 37063 37145
138 | 37137 2
139 | 37031 37049
140 | 37139 5
141 | 37029 37041 37053 37143 37177
142 | 37141 2
143 | 37061 37129
144 | 37143 7
145 | 37029 37041 37073 37091 37139 37177 37187
146 | 37145 4
147 | 37033 37063 37077 37135
148 | 37147 5
149 | 37013 37065 37079 37107 37117
150 | 37149 2
151 | 37089 37161
152 | 37151 3
153 | 37057 37081 37123
154 | 37153 2
155 | 37007 37165
156 | 37155 4
157 | 37017 37047 37093 37165
158 | 37157 3
159 | 37033 37081 37169
160 | 37159 5
161 | 37025 37057 37059 37097 37167
162 | 37161 5
163 | 37023 37045 37089 37111 37149
164 | 37163 2
165 | 37051 37061
166 | 37165 3
167 | 37093 37153 37155
168 | 37167 4
169 | 37007 37025 37123 37159
170 | 37169 3
171 | 37067 37157 37171
172 | 37171 4
173 | 37005 37169 37193 37197
174 | 37173 4
175 | 37075 37087 37099 37113
176 | 37175 4
177 | 37021 37087 37089 37099
178 | 37177 5
179 | 37029 37041 37139 37143 37187
180 | 37179 3
181 | 37007 37025 37119
182 | 37181 3
183 | 37069 37077 37185
184 | 37183 5
185 | 37037 37063 37069 37085 37101
186 | 37185 3
187 | 37069 37077 37181
188 | 37187 6
189 | 37013 37015 37041 37117 37143 37177
190 | 37189 4
191 | 37009 37011 37027 37121
192 | 37191 4
193 | 37079 37101 37107 37195
194 | 37193 7
195 | 37003 37005 37009 37027 37097 37171 37197
196 | 37195 5
197 | 37065 37079 37101 37127 37191
198 | 37197 5
199 | 37059 37067 37097 37171 37193
200 | 37199 5
201 | 37011 37021 37111 37115 37121
202 |
--------------------------------------------------------------------------------
/inst/weights/ncCR85.gal:
--------------------------------------------------------------------------------
1 | 0 100 sids rn
2 | 37001 6
3 | 37033 37037 37081 37135 37151 37157
4 | 37003 4
5 | 37027 37035 37097 37193
6 | 37005 3
7 | 37009 37171 37193
8 | 37007 4
9 | 37123 37153 37167 37179
10 | 37009 3
11 | 37005 37189 37193
12 | 37011 5
13 | 37023 37027 37111 37121 37189
14 | 37013 6
15 | 37049 37095 37117 37137 37147 37187
16 | 37015 5
17 | 37083 37091 37117 37131 37187
18 | 37017 5
19 | 37047 37051 37141 37155 37163
20 | 37019 3
21 | 37047 37129 37141
22 | 37021 7
23 | 37087 37089 37111 37115 37161 37175 37199
24 | 37023 7
25 | 37011 37027 37035 37045 37109 37111 37161
26 | 37025 5
27 | 37097 37119 37159 37167 37179
28 | 37027 6
29 | 37003 37011 37023 37035 37189 37193
30 | 37029 3
31 | 37053 37073 37139
32 | 37031 3
33 | 37049 37103 37133
34 | 37033 5
35 | 37001 37081 37135 37145 37157
36 | 37035 6
37 | 37003 37023 37027 37045 37097 37109
38 | 37037 8
39 | 37001 37063 37085 37105 37125 37135 37151 37183
40 | 37039 4
41 | 37043 37075 37113 37173
42 | 37041 2
43 | 37073 37143
44 | 37043 2
45 | 37039 37113
46 | 37045 5
47 | 37023 37035 37071 37109 37161
48 | 37047 4
49 | 37017 37019 37141 37155
50 | 37049 6
51 | 37013 37031 37103 37107 37137 37147
52 | 37051 6
53 | 37017 37085 37093 37125 37155 37163
54 | 37053 1
55 | 37029
56 | 37055 1
57 | 37095
58 | 37057 7
59 | 37059 37067 37081 37123 37151 37159 37167
60 | 37059 5
61 | 37057 37067 37097 37159 37197
62 | 37061 6
63 | 37103 37107 37133 37141 37163 37191
64 | 37063 5
65 | 37037 37077 37135 37145 37183
66 | 37065 5
67 | 37083 37117 37127 37147 37195
68 | 37067 7
69 | 37057 37059 37081 37157 37169 37171 37197
70 | 37069 7
71 | 37077 37083 37101 37127 37181 37183 37185
72 | 37071 3
73 | 37045 37109 37119
74 | 37073 5
75 | 37029 37041 37091 37139 37143
76 | 37075 3
77 | 37039 37113 37173
78 | 37077 5
79 | 37063 37069 37145 37181 37183
80 | 37079 4
81 | 37107 37147 37191 37195
82 | 37081 7
83 | 37001 37033 37057 37067 37151 37157 37169
84 | 37083 7
85 | 37015 37065 37069 37117 37127 37131 37185
86 | 37085 7
87 | 37037 37051 37101 37105 37125 37163 37183
88 | 37087 6
89 | 37021 37089 37099 37115 37173 37175
90 | 37089 5
91 | 37021 37087 37149 37161 37175
92 | 37091 3
93 | 37015 37073 37131
94 | 37093 5
95 | 37051 37125 37153 37155 37165
96 | 37095 4
97 | 37013 37055 37177 37187
98 | 37097 9
99 | 37003 37025 37035 37059 37109 37119 37159 37193 37197
100 | 37099 4
101 | 37087 37113 37173 37175
102 | 37101 7
103 | 37069 37085 37127 37163 37183 37191 37195
104 | 37103 5
105 | 37031 37049 37061 37107 37133
106 | 37105 3
107 | 37037 37085 37125
108 | 37107 6
109 | 37049 37061 37079 37103 37147 37191
110 | 37109 6
111 | 37023 37035 37045 37071 37097 37119
112 | 37111 6
113 | 37011 37021 37023 37121 37161 37199
114 | 37113 5
115 | 37039 37043 37075 37099 37173
116 | 37115 3
117 | 37021 37087 37199
118 | 37117 6
119 | 37013 37015 37065 37083 37147 37187
120 | 37119 5
121 | 37025 37071 37097 37109 37179
122 | 37121 3
123 | 37011 37111 37199
124 | 37123 7
125 | 37007 37057 37125 37151 37153 37159 37167
126 | 37125 9
127 | 37037 37051 37085 37093 37105 37123 37151 37153 37165
128 | 37127 7
129 | 37065 37069 37083 37101 37183 37185 37195
130 | 37129 2
131 | 37019 37141
132 | 37131 3
133 | 37015 37083 37091
134 | 37133 4
135 | 37031 37061 37103 37141
136 | 37135 5
137 | 37001 37033 37037 37063 37145
138 | 37137 2
139 | 37013 37049
140 | 37139 3
141 | 37029 37073 37143
142 | 37141 7
143 | 37017 37019 37047 37061 37129 37133 37163
144 | 37143 3
145 | 37041 37073 37139
146 | 37145 4
147 | 37033 37063 37077 37135
148 | 37147 7
149 | 37013 37049 37065 37079 37107 37117 37195
150 | 37149 2
151 | 37089 37161
152 | 37151 6
153 | 37001 37037 37057 37081 37123 37125
154 | 37153 6
155 | 37007 37093 37123 37125 37165 37167
156 | 37155 5
157 | 37017 37047 37051 37093 37165
158 | 37157 5
159 | 37001 37033 37067 37081 37169
160 | 37159 6
161 | 37025 37057 37059 37097 37123 37167
162 | 37161 6
163 | 37021 37023 37045 37089 37111 37149
164 | 37163 7
165 | 37017 37051 37061 37085 37101 37141 37191
166 | 37165 4
167 | 37093 37125 37153 37155
168 | 37167 7
169 | 37007 37025 37057 37123 37153 37159 37179
170 | 37169 4
171 | 37067 37081 37157 37171
172 | 37171 5
173 | 37005 37067 37169 37193 37197
174 | 37173 5
175 | 37039 37075 37087 37099 37113
176 | 37175 4
177 | 37021 37087 37089 37099
178 | 37177 2
179 | 37095 37187
180 | 37179 4
181 | 37007 37025 37119 37167
182 | 37181 3
183 | 37069 37077 37185
184 | 37183 7
185 | 37037 37063 37069 37077 37085 37101 37127
186 | 37185 4
187 | 37069 37083 37127 37181
188 | 37187 5
189 | 37013 37015 37095 37117 37177
190 | 37189 4
191 | 37009 37011 37027 37193
192 | 37191 6
193 | 37061 37079 37101 37107 37163 37195
194 | 37193 8
195 | 37003 37005 37009 37027 37097 37171 37189 37197
196 | 37195 6
197 | 37065 37079 37101 37127 37147 37191
198 | 37197 5
199 | 37059 37067 37097 37171 37193
200 | 37199 4
201 | 37021 37111 37115 37121
202 |
--------------------------------------------------------------------------------
/man/SplashDams.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/SplashDams.R
3 | \docType{data}
4 | \name{SplashDams}
5 | \alias{SplashDams}
6 | \title{Data for Splash Dams in western Oregon}
7 | \format{
8 | Formal class 'SpatialPointsDataFrame with 232 obs. of 6 variables:
9 | \itemize{
10 | \item{streamName} {}
11 | \item{locationCode} {}
12 | \item{height} {}
13 | \item{lastDate} {}
14 | \item{owner} {}
15 | \item{datesUsed} {}
16 | }
17 | }
18 | \source{
19 | R. R. Miller (2010) Is the Past Present? Historical Splash-dam Mapping and Stream Disturbance Detection in the Oregon Coastal Province. MSc. thesis, Oregon State University; packaged by Jonathan Callahan
20 | }
21 | \usage{
22 | SplashDams
23 | }
24 | \description{
25 | Data for Splash Dams in western Oregon
26 | }
27 | \examples{
28 | if (requireNamespace("sp", quietly = TRUE)) {
29 | library(sp)
30 | data(SplashDams)
31 | plot(SplashDams, axes=TRUE)
32 | }
33 | }
34 | \keyword{datasets}
35 | \keyword{sp}
36 |
--------------------------------------------------------------------------------
/man/afcon.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/afcon.R
3 | \docType{data}
4 | \name{afcon}
5 | \alias{afcon}
6 | \alias{africa.rook.nb}
7 | \alias{afxy}
8 | \alias{paper.nb}
9 | \title{Spatial patterns of conflict in Africa 1966-78}
10 | \format{
11 | This data frame contains the following columns:
12 | \itemize{
13 | \item{x: an easting in decimal degrees (taken as centroid of shapefile polygon)}
14 | \item{y: an northing in decimal degrees (taken as centroid of shapefile polygon)}
15 | \item{totcon: index of total conflict 1966-78}
16 | \item{name: country name}
17 | \item{id: country id number as in paper}
18 | }
19 | }
20 | \source{
21 | Anselin, L. and John O'Loughlin. 1992. Geography of international conflict and cooperation: spatial dependence and regional context in Africa. In The New Geopolitics, ed. M. Ward, pp. 39-75. Philadelphia, PA: Gordon and Breach.
22 | also:
23 | Anselin, L. 1995. Local indicators of spatial association, Geographical Analysis, 27, Table 1, p. 103.
24 | }
25 | \usage{
26 | afcon
27 | }
28 | \description{
29 | The \code{afcon} data frame has 42 rows and 5 columns, for 42 African countries, exclusing then South West Africa and Spanish Equatorial Africa and Spanish Sahara. The dataset is used in Anselin (1995), and downloaded from before adaptation. The neighbour list object \code{africa.rook.nb} is the SpaceStat \file{rook.GAL}, but is not the list used in Anselin (1995) - \code{paper.nb} reconstructs the list used in the paper, with inserted links between Mauritania and Morocco, South Africa and Angola and Zambia, Tanzania and Zaire, and Botswana and Zambia. \code{afxy} is the coordinate matrix for the centroids of the countries.
30 | }
31 | \note{
32 | All source data files prepared by Luc Anselin, Spatial Analysis Laboratory, Department of Agricultural and Consumer Economics, University of Illinois, Urbana-Champaign.
33 | }
34 | \examples{
35 | data(afcon)
36 | if (requireNamespace("spdep", quietly = TRUE)) {
37 | library(spdep)
38 | plot(africa.rook.nb, afxy)
39 | plot(diffnb(paper.nb, africa.rook.nb), afxy, col="red", add=TRUE)
40 | text(afxy, labels=attr(africa.rook.nb, "region.id"), pos=4, offset=0.4)
41 | moran.test(afcon$totcon, nb2listw(africa.rook.nb))
42 | moran.test(afcon$totcon, nb2listw(paper.nb))
43 | geary.test(afcon$totcon, nb2listw(paper.nb))
44 | }
45 | }
46 | \keyword{datasets}
47 | \keyword{spdep}
48 |
--------------------------------------------------------------------------------
/man/alaska.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/alaska.R
3 | \docType{data}
4 | \name{alaska}
5 | \alias{alaska}
6 | \title{Alaska multipolygon}
7 | \format{
8 | Formal class 'sf' [package "sf"]; the data contains a data.frame with 1 obs. of 7 variables:
9 | \itemize{
10 | \item{GEOID: character vector of geographic identifiers}
11 | \item{NAME: character vector of state names}
12 | \item{REGION: character vector of region names}
13 | \item{AREA: area in square kilometers of units class}
14 | \item{total_pop_10: numerical vector of total population in 2010}
15 | \item{total_pop_15: numerical vector of total population in 2015}
16 | \item{geometry: sfc_MULTIPOLYGON}
17 | }
18 | The object is in projected coordinates using Alaska Albers (EPSG:3467).
19 | }
20 | \source{
21 | \url{https://www.census.gov/geographies/mapping-files/time-series/geo/tiger-line-file.html}
22 | }
23 | \usage{
24 | alaska
25 | }
26 | \description{
27 | The object loaded is a \code{sf} object containing the state of
28 | Alaska from the US Census Bureau
29 | with a few variables from American Community Survey (ACS)
30 | }
31 | \examples{
32 | if (requireNamespace("sf", quietly = TRUE)) {
33 | library(sf)
34 | data(alaska)
35 |
36 | plot(alaska["total_pop_15"])
37 | }
38 | }
39 | \seealso{
40 | See the tigris package: https://cran.r-project.org/package=tigris
41 | }
42 | \keyword{datasets}
43 | \keyword{sf}
44 |
--------------------------------------------------------------------------------
/man/auckland.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/auckland.R
3 | \docType{data}
4 | \name{auckland}
5 | \alias{auckland}
6 | \alias{auckland.nb}
7 | \alias{auckpolys}
8 | \title{Marshall's infant mortality in Auckland dataset}
9 | \format{
10 | This data frame contains the following columns:
11 | \itemize{
12 | \item{Easting: a numeric vector of x coordinates in an unknown spatial reference system}
13 | \item{Northing: a numeric vector of y coordinates in an unknown spatial reference system}
14 | \item{M77_85: a numeric vector of counts of infant (under 5 years of age) deaths in Auckland, 1977-1985}
15 | \item{Und5_81: a numeric vector of population under 5 years of age at the 1981 Census}
16 | }
17 | }
18 | \source{
19 | Marshall R M (1991) Mapping disease and mortality rates using Empirical Bayes Estimators, Applied Statistics, 40, 283--294; Bailey T, Gatrell A (1995) Interactive Spatial Data Analysis, Harlow: Longman --- INFOMAP data set used with permission.
20 | }
21 | \usage{
22 | auckland
23 | }
24 | \description{
25 | (Use \code{example(auckland)} to load the data from shapefile and generate neighbour list on the fly). The \code{auckland} data frame has 167 rows (census area units --- CAU) and 4 columns. The dataset also includes the "nb" object \code{auckland.nb} of neighbour relations based on contiguity, and the "polylist" object \code{auckpolys} of polygon boundaries for the CAU. The \code{auckland} data frame includes the following columns:
26 | }
27 | \details{
28 | The contiguous neighbours object does not completely replicate results in the sources, and was reconstructed from \code{auckpolys}; examination of figures in the sources suggests that there are differences in detail, although probably not in substance.
29 | }
30 | \examples{
31 | if (requireNamespace("sf", quietly = TRUE)) {
32 | auckland <- sf::st_read(system.file("shapes/auckland.gpkg", package="spData")[1])
33 | plot(sf::st_geometry(auckland))
34 | if (requireNamespace("spdep", quietly = TRUE)) {
35 | auckland.nb <- spdep::poly2nb(auckland)
36 | }
37 | }
38 |
39 | }
40 | \keyword{datasets}
41 | \keyword{sp}
42 |
--------------------------------------------------------------------------------
/man/baltimore.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/baltimore.R
3 | \docType{data}
4 | \name{baltimore}
5 | \alias{baltimore}
6 | \title{House sales prices, Baltimore, MD 1978}
7 | \format{
8 | A data frame with 211 observations on the following 17 variables.
9 | \itemize{
10 | \item{STATION: a numeric vector}
11 | \item{PRICE: a numeric vector}
12 | \item{NROOM: a numeric vector}
13 | \item{DWELL: a numeric vector}
14 | \item{NBATH: a numeric vector}
15 | \item{PATIO: a numeric vector}
16 | \item{FIREPL: a numeric vector}
17 | \item{AC: a numeric vector}
18 | \item{BMENT: a numeric vector}
19 | \item{NSTOR: a numeric vector}
20 | \item{GAR: a numeric vector}
21 | \item{AGE: a numeric vector}
22 | \item{CITCOU: a numeric vector}
23 | \item{LOTSZ: a numeric vector}
24 | \item{SQFT: a numeric vector}
25 | \item{X: a numeric vector}
26 | \item{Y: a numeric vector}
27 | }
28 | }
29 | \source{
30 | Prepared by Luc Anselin. Original data made available by Robin Dubin, Weatherhead School of Management, Case Western Research University, Cleveland, OH. http://sal.agecon.uiuc.edu/datasets/baltimore.zip
31 | }
32 | \usage{
33 | baltimore
34 | }
35 | \description{
36 | House sales price and characteristics for a spatial hedonic regression, Baltimore, MD 1978. X,Y on Maryland grid, projection type unknown.
37 | }
38 | \examples{
39 | data(baltimore)
40 | str(baltimore)
41 |
42 | if (requireNamespace("sf", quietly = TRUE)) {
43 | library(sf)
44 | baltimore_sf <- baltimore \%>\% st_as_sf(., coords = c("X","Y"))
45 | plot(baltimore_sf["PRICE"])
46 | }
47 | }
48 | \references{
49 | Dubin, Robin A. (1992). Spatial autocorrelation and neighborhood quality. Regional Science and Urban Economics 22(3), 433-452.
50 | }
51 | \keyword{datasets}
52 | \keyword{sf}
53 |
--------------------------------------------------------------------------------
/man/boston.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/boston.R
3 | \docType{data}
4 | \name{boston}
5 | \alias{boston}
6 | \alias{boston.c}
7 | \alias{boston.soi}
8 | \alias{boston.utm}
9 | \title{Corrected Boston Housing Data}
10 | \format{
11 | This data frame contains the following columns:
12 | \itemize{
13 | \item{TOWN: a factor with levels given by town names}
14 | \item{TOWNNO: a numeric vector corresponding to TOWN}
15 | \item{TRACT: a numeric vector of tract ID numbers}
16 | \item{LON: a numeric vector of tract point longitudes in decimal degrees}
17 | \item{LAT: a numeric vector of tract point latitudes in decimal degrees}
18 | \item{MEDV: a numeric vector of median values of owner-occupied housing
19 | in USD 1000}
20 | \item{CMEDV: a numeric vector of corrected median values of
21 | owner-occupied housing in USD 1000}
22 | \item{CRIM: a numeric vector of per capita crime}
23 | \item{ZN: a numeric vector of proportions of residential land zoned
24 | for lots over 25000 sq. ft per town (constant for all Boston tracts)}
25 | \item{INDUS: a numeric vector of proportions of non-retail business
26 | acres per town (constant for all Boston tracts)}
27 | \item{CHAS: a factor with levels 1 if tract borders Charles River;
28 | 0 otherwise}
29 | \item{NOX: a numeric vector of nitric oxides concentration (parts per
30 | 10 million) per town}
31 | \item{RM: a numeric vector of average numbers of rooms per dwelling}
32 | \item{AGE: a numeric vector of proportions of owner-occupied units
33 | built prior to 1940}
34 | \item{DIS: a numeric vector of weighted distances to five Boston
35 | employment centres}
36 | \item{RAD: a numeric vector of an index of accessibility to radial
37 | highways per town (constant for all Boston tracts)}
38 | \item{TAX: a numeric vector full-value property-tax rate per USD
39 | 10,000 per town (constant for all Boston tracts)}
40 | \item{PTRATIO: a numeric vector of pupil-teacher ratios per town
41 | (constant for all Boston tracts)}
42 | \item{B: a numeric vector of \code{1000*(Bk - 0.63)^2} where Bk is the
43 | proportion of blacks}
44 | \item{LSTAT: a numeric vector of percentage values of lower status
45 | population}
46 | }
47 | }
48 | \source{
49 | Previously available from http://lib.stat.cmu.edu/datasets/boston_corrected.txt
50 | }
51 | \description{
52 | The \code{boston.c} data frame has 506 rows and 20 columns. It contains the Harrison and Rubinfeld (1978) data corrected for a few minor errors and augmented with the latitude and longitude of the observations. Gilley and Pace also point out that MEDV is censored, in that median values at or over USD 50,000 are set to USD 50,000. The original data set without the corrections is also included in package \code{mlbench} as \code{BostonHousing}. In addition, a matrix of tract point coordinates projected to UTM zone 19 is included as \code{boston.utm}, and a sphere of influence neighbours list as \code{boston.soi}.
53 | }
54 | \note{
55 | Details of the creation of the tract GPKG file: tract boundaries for 1990 (formerly at: http://www.census.gov/geo/cob/bdy/tr/tr90shp/tr25_d90_shp.zip, counties in the BOSTON SMSA http://www.census.gov/population/metro/files/lists/historical/63mfips.txt); tract conversion table 1980/1970 (formerly at : https://www.icpsr.umich.edu/icpsrweb/ICPSR/studies/7913?q=07913&permit[0]=AVAILABLE, http://www.icpsr.umich.edu/cgi-bin/bob/zipcart2?path=ICPSR&study=7913&bundle=all&ds=1&dups=yes). The shapefile contains corrections and extra variables (tract 3592 is corrected to 3593; the extra columns are:
56 | \itemize{
57 | \item{units: number of single family houses}
58 | \item{cu5k: count of units under USD 5,000}
59 | \item{c5_7_5: counts USD 5,000 to 7,500}
60 | \item{C*_*: interval counts}
61 | \item{co50k: count of units over USD 50,000}
62 | \item{median: recomputed median values}
63 | \item{BB: recomputed black population proportion}
64 | \item{censored: whether censored or not}
65 | \item{NOXID: NOX model zone ID}
66 | \item{POP: tract population}
67 | }
68 | }
69 | \examples{
70 | if (requireNamespace("spdep", quietly = TRUE)) {
71 | data(boston)
72 | hr0 <- lm(log(MEDV) ~ CRIM + ZN + INDUS + CHAS + I(NOX^2) + I(RM^2) +
73 | AGE + log(DIS) + log(RAD) + TAX + PTRATIO + B + log(LSTAT), data = boston.c)
74 | summary(hr0)
75 | logLik(hr0)
76 | gp0 <- lm(log(CMEDV) ~ CRIM + ZN + INDUS + CHAS + I(NOX^2) + I(RM^2) +
77 | AGE + log(DIS) + log(RAD) + TAX + PTRATIO + B + log(LSTAT), data = boston.c)
78 | summary(gp0)
79 | logLik(gp0)
80 | spdep::lm.morantest(hr0, spdep::nb2listw(boston.soi))
81 | }
82 | if (requireNamespace("sf", quietly = TRUE)) {
83 | boston.tr <- sf::st_read(system.file("shapes/boston_tracts.gpkg",
84 | package="spData")[1])
85 | if (requireNamespace("spdep", quietly = TRUE)) {
86 | boston_nb <- spdep::poly2nb(boston.tr)
87 | }
88 | }
89 |
90 | }
91 | \references{
92 | Harrison, David, and Daniel L. Rubinfeld, Hedonic Housing Prices and the Demand for Clean Air, \emph{Journal of Environmental Economics and Management}, Volume 5, (1978), 81-102. Original data.
93 |
94 | Gilley, O.W., and R. Kelley Pace, On the Harrison and Rubinfeld Data, \emph{Journal of Environmental Economics and Management}, 31 (1996),403-405. Provided corrections and examined censoring.
95 |
96 | Pace, R. Kelley, and O.W. Gilley, Using the Spatial Configuration of the Data to Improve Estimation, \emph{Journal of the Real Estate Finance and Economics}, 14 (1997), 333-340.
97 |
98 | Bivand, Roger. Revisiting the Boston data set - Changing the units of observation affects estimated willingness to pay for clean air. REGION, v. 4, n. 1, p. 109-127, 2017. \url{https://openjournals.wu.ac.at/ojs/index.php/region/article/view/107}.
99 | }
100 | \keyword{datasets}
101 | \keyword{spdep}
102 |
--------------------------------------------------------------------------------
/man/coffee_data.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/coffee_data.R
3 | \docType{data}
4 | \name{coffee_data}
5 | \alias{coffee_data}
6 | \title{World coffee production data}
7 | \format{
8 | A data frame (tibble) with 58 for the following 12 variables:
9 | \itemize{
10 | \item{name_long: name of country or coffee variety}
11 | \item{coffee_production_2016: production in 2016}
12 | \item{coffee_production_2017: production in 2017}
13 | }
14 | }
15 | \source{
16 | The International Coffee Organization (ICO). See http://www.ico.org/ and
17 | http://www.ico.org/prices/m1-exports.pdf
18 | }
19 | \usage{
20 | coffee_data
21 | }
22 | \description{
23 | A tiny dataset containing estimates of global coffee in thousands of 60 kg bags produced by country.
24 | Purpose: teaching **not** research.
25 | }
26 | \details{
27 | The examples section shows how this can be joined with spatial data to create a simple map.
28 | }
29 | \examples{
30 | head(coffee_data)
31 | \dontrun{
32 | if (requireNamespace("dplyr")) {
33 | library(dplyr)
34 | library(sf)
35 | # found by searching for "global coffee data"
36 | u = "http://www.ico.org/prices/m1-exports.pdf"
37 | download.file(u, "data.pdf", mode = "wb")
38 | if (requireNamespace("pdftables")) { # requires api key
39 | pdftables::convert_pdf(input_file = "data.pdf", output_file = "coffee-data-messy.csv")
40 | d = read_csv("coffee-data-messy.csv")
41 | file.remove("coffee-data-messy.csv")
42 | file.remove("data.pdf")
43 | coffee_data = slice(d, -c(1:9)) \%>\%
44 | select(name_long = 1, coffee_production_2016 = 2, coffee_production_2017 = 3) \%>\%
45 | filter(!is.na(coffee_production_2016)) \%>\%
46 | mutate_at(2:3, str_replace, " ", "") \%>\%
47 | mutate_at(2:3, as.integer)
48 | world_coffee = left_join(world, coffee_data)
49 | plot(world_coffee[c("coffee_production_2016", "coffee_production_2017")])
50 | b = c(0, 500, 1000, 2000, 3000)
51 | library(tmap)
52 | tm_shape(world_coffee) +
53 | tm_fill("coffee_production_2017", title = "Thousand 60kg bags", breaks = b,
54 | textNA = "No data", colorNA = NULL)
55 | tmap_mode("view") # for an interactive version
56 | }}
57 | }
58 | }
59 | \keyword{datasets}
60 | \keyword{misc}
61 |
--------------------------------------------------------------------------------
/man/columbus.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/columbus.R
3 | \docType{data}
4 | \name{columbus}
5 | \alias{columbus}
6 | \alias{col.gal.nb}
7 | \alias{coords}
8 | \alias{polys}
9 | \alias{bbs}
10 | \title{Columbus OH spatial analysis data set}
11 | \format{
12 | This data frame contains the following columns:
13 | \itemize{
14 | \item{AREA: computed by ArcView}
15 | \item{PERIMETER: computed by ArcView}
16 | \item{COLUMBUS_: internal polygon ID (ignore)}
17 | \item{COLUMBUS_I: another internal polygon ID (ignore)}
18 | \item{POLYID: yet another polygon ID}
19 | \item{NEIG: neighborhood id value (1-49);
20 | conforms to id value used in Spatial Econometrics book.}
21 | \item{HOVAL: housing value (in 1,000 USD)}
22 | \item{INC: household income (in 1,000 USD)}
23 | \item{CRIME: residential burglaries and vehicle thefts per thousand
24 | households in the neighborhood}
25 | \item{OPEN: open space in neighborhood}
26 | \item{PLUMB: percentage housing units without plumbing}
27 | \item{DISCBD: distance to CBD}
28 | \item{X: x coordinate (in arbitrary digitizing units, not polygon coordinates)}
29 | \item{Y: y coordinate (in arbitrary digitizing units, not polygon coordinates)}
30 | \item{NSA: north-south dummy (North=1)}
31 | \item{NSB: north-south dummy (North=1)}
32 | \item{EW: east-west dummy (East=1)}
33 | \item{CP: core-periphery dummy (Core=1)}
34 | \item{THOUS: constant=1,000}
35 | \item{NEIGNO: NEIG+1,000, alternative neighborhood id value}
36 | }
37 | }
38 | \source{
39 | Anselin, Luc. 1988. Spatial econometrics: methods and models. Dordrecht: Kluwer Academic, Table 12.1 p. 189.
40 | }
41 | \usage{
42 | columbus
43 | }
44 | \description{
45 | The \code{columbus} data frame has 49 rows and 22 columns. Unit of analysis: 49 neighbourhoods in Columbus, OH, 1980 data. In addition the data set includes a \code{polylist} object \code{polys} with the boundaries of the neighbourhoods, a matrix of polygon centroids \code{coords}, and \code{col.gal.nb}, the neighbours list from an original GAL-format file. The matrix \code{bbs} is DEPRECATED, but retained for other packages using this data set.
46 | }
47 | \details{
48 | The row names of \code{columbus} and the \code{region.id} attribute of \code{polys} are set to \code{columbus$NEIGNO}.
49 | }
50 | \note{
51 | All source data files prepared by Luc Anselin, Spatial Analysis Laboratory, Department of Agricultural and Consumer Economics, University of Illinois, Urbana-Champaign, http://sal.agecon.uiuc.edu/datasets/columbus.zip.
52 | }
53 | \examples{
54 | if (requireNamespace("sf", quietly = TRUE)) {
55 | columbus <- sf::st_read(system.file("shapes/columbus.gpkg", package="spData")[1])
56 | plot(sf::st_geometry(columbus))
57 | }
58 |
59 | if (requireNamespace("spdep", quietly = TRUE)) {
60 | library(spdep)
61 | col.gal.nb <- read.gal(system.file("weights/columbus.gal", package="spData")[1])
62 | }
63 | }
64 | \keyword{datasets}
65 | \keyword{sp}
66 | \keyword{spdep}
67 |
--------------------------------------------------------------------------------
/man/congruent.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/congruent.R
3 | \docType{data}
4 | \name{congruent}
5 | \alias{congruent}
6 | \alias{incongruent}
7 | \alias{aggregating_zones}
8 | \title{Datasets to illustrate the concept of spatial congruence}
9 | \format{
10 | Simple feature geographic data in a projected CRS (OSGB) with random values assigned
11 | for teaching purposes.
12 | }
13 | \source{
14 | \url{https://en.wikipedia.org/wiki/ONS_coding_system}
15 | }
16 | \usage{
17 | congruent
18 | }
19 | \description{
20 | Sample of old (incongruent) and new (congruent) administrative zones
21 | from UK statistical agencies
22 | }
23 | \examples{
24 | if(requireNamespace("sf", quietly = TRUE)) {
25 | library(sf)
26 | plot(aggregating_zones$geometry, lwd = 5)
27 | plot(congruent$geometry, add = TRUE, border = "green", lwd = 2)
28 | plot(incongruent$geometry, add = TRUE, border = "blue", col = NA)
29 | rbind(congruent, incongruent)
30 | }
31 | # Code used to download the data:
32 | \dontrun{
33 | #devtools::install_github("robinlovelace/ukboundaries")
34 | library(sf)
35 | library(tmap)
36 | library(dplyr)
37 | #library(ukboundaries)
38 | sel = grepl("003|004", msoa2011_lds$geo_label)
39 | aggregating_zones = st_transform(msoa2011_lds[sel, ], 27700)
40 | # find lsoas in the aggregating_zones
41 | lsoa_touching = st_transform(lsoa2011_lds, 27700)[aggregating_zones, ]
42 | lsoa_cents = st_centroid(lsoa_touching)
43 | lsoa_cents = lsoa_cents[aggregating_zones, ]
44 | sel = lsoa_touching$geo_code \%in\% lsoa_cents$geo_code
45 | # same for ed zones
46 | ed_touching = st_transform(ed1981, 27700)[aggregating_zones, ]
47 | ed_cents = st_centroid(ed_touching)
48 | ed_cents = ed_cents[aggregating_zones, ]
49 | incongruent_agg_ed = ed_touching[ed_cents, ]
50 | set.seed(2017)
51 | incongruent_agg_ed$value = rnorm(nrow(incongruent_agg_ed), mean = 5)
52 | congruent = aggregate(incongruent_agg_ed["value"], lsoa_touching[sel, ], mean)
53 | congruent$level = "Congruent"
54 | congruent = congruent[c("level", "value")]
55 | incongruent_cents = st_centroid(incongruent_agg_ed)
56 | aggregating_value = st_join(incongruent_cents, congruent)$value.y
57 | incongruent_agg = aggregate(incongruent_agg_ed["value"], list(aggregating_value), FUN = mean)
58 | incongruent_agg$level = "Incongruent"
59 | incongruent = incongruent_agg[c("level", "value")]
60 | summary(st_geometry_type(congruent))
61 | summary(st_geometry_type(incongruent))
62 | incongruent = st_cast(incongruent, "MULTIPOLYGON")
63 | summary(st_geometry_type(incongruent))
64 | summary(st_geometry_type(aggregating_zones))
65 | devtools::use_data(congruent, overwrite = TRUE)
66 | devtools::use_data(incongruent, overwrite = TRUE)
67 | devtools::use_data(aggregating_zones, overwrite = TRUE)
68 | }
69 | }
70 | \keyword{datasets}
71 | \keyword{sf}
72 |
--------------------------------------------------------------------------------
/man/cycle_hire.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/cycle_hire.R
3 | \docType{data}
4 | \name{cycle_hire}
5 | \alias{cycle_hire}
6 | \title{Cycle hire points in London}
7 | \format{
8 | FORMAT:
9 | \itemize{
10 | \item{id: Id of the hire point}
11 | \item{name: Name of the point}
12 | \item{area: Area they are in}
13 | \item{nbikes: The number of bikes currently parked there}
14 | \item{nempty: The number of empty places}
15 | \item{geometry: sfc_POINT}
16 | }
17 | }
18 | \source{
19 | \url{https://www.data.gov.uk/}
20 | }
21 | \usage{
22 | cycle_hire
23 | }
24 | \description{
25 | Points
26 | representing cycle hire points accross London.
27 | }
28 | \examples{
29 | if (requireNamespace("sf", quietly = TRUE)) {
30 | library(sf)
31 | data(cycle_hire)
32 | # or
33 | cycle_hire <- st_read(system.file("shapes/cycle_hire.geojson", package="spData"))
34 |
35 | plot(cycle_hire)
36 | }
37 |
38 | \dontrun{
39 | # Download the data
40 | cycle_hire = readr::read_csv("http://cyclehireapp.com/cyclehirelive/cyclehire.csv",
41 | col_names = FALSE, skip = TRUE)
42 | cycle_hire = cycle_hire[c_names]
43 | c_names = c("id", "name", "area", "lat", "lon", "nbikes", "nempty")
44 | cycle_hire = st_sf(cycle_hire, st_multipoint(c_names[c("lon", "lat")]))
45 | }
46 | }
47 | \keyword{datasets}
48 | \keyword{sf}
49 |
--------------------------------------------------------------------------------
/man/cycle_hire_osm.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/cycle_hire_osm.R
3 | \docType{data}
4 | \name{cycle_hire_osm}
5 | \alias{cycle_hire_osm}
6 | \title{Cycle hire points in London from OSM}
7 | \format{
8 | \itemize{
9 | \item{osm_id: The OSM ID}
10 | \item{name: The name of the cycle point}
11 | \item{capacity: How many bikes it can take}
12 | \item{cyclestreets_id: The ID linked to cyclestreets' photomap}
13 | \item{description: Additional description of points}
14 | \item{geometry: sfc_POINT}
15 | }
16 | }
17 | \source{
18 | \url{https://www.openstreetmap.org}
19 | }
20 | \usage{
21 | cycle_hire_osm
22 | }
23 | \description{
24 | Dataset downloaded using the osmdata package
25 | representing cycle hire points accross London.
26 | }
27 | \examples{
28 | if (requireNamespace("sf", quietly = TRUE)) {
29 | library(sf)
30 | data(cycle_hire_osm)
31 | # or
32 | cycle_hire_osm <- st_read(system.file("shapes/cycle_hire_osm.geojson", package="spData"))
33 |
34 | plot(cycle_hire_osm)
35 | }
36 |
37 | # Code used to download the data:
38 | \dontrun{
39 | library(osmdata)
40 | library(dplyr)
41 | library(sf)
42 | q = add_osm_feature(opq = opq("London"), key = "network", value = "tfl_cycle_hire")
43 | lnd_cycle_hire = osmdata_sf(q)
44 | cycle_hire_osm = lnd_cycle_hire$osm_points
45 | nrow(cycle_hire_osm)
46 | plot(cycle_hire_osm)
47 | cycle_hire_osm = dplyr::select(cycle_hire_osm, osm_id, name, capacity,
48 | cyclestreets_id, description) \%>\%
49 | mutate(capacity = as.numeric(capacity))
50 | names(cycle_hire_osm)
51 | nrow(cycle_hire_osm)
52 | }
53 | }
54 | \seealso{
55 | See the osmdata package: https://cran.r-project.org/package=osmdata
56 | }
57 | \keyword{datasets}
58 | \keyword{sf}
59 |
--------------------------------------------------------------------------------
/man/depmunic.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/depmunic.R
3 | \docType{data}
4 | \name{depmunic}
5 | \alias{depmunic}
6 | \title{Municipality departments of Athens (Sf)}
7 | \format{
8 | An sf object of 7 polygons with the following 7 variables.
9 | \itemize{
10 | \item{num_dep: An unique identifier for each municipality department.}
11 | \item{airbnb: The number of airbnb properties in 2017}
12 | \item{museums: The number of museums}
13 | \item{population: The population recorded in census at 2011.}
14 | \item{pop_rest: The number of citizens that the origin is a non european country.}
15 | \item{greensp: The area of green spaces (unit: square meters).}
16 | \item{area: The area of the polygon (unit: square kilometers). }
17 | }
18 | }
19 | \usage{
20 | depmunic
21 | }
22 | \description{
23 | The geographic boundaries of departments (sf) of the municipality of Athens. This is accompanied by various characteristics in these areas.
24 | }
25 | \examples{
26 | if (requireNamespace("sf", quietly = TRUE)) {
27 | library(sf)
28 | data(depmunic)
29 |
30 | depmunic$foreigners <- 100*depmunic$pop_rest/depmunic$population
31 | plot(depmunic["foreigners"], key.pos=1)
32 | }
33 | }
34 | \seealso{
35 | properties
36 | }
37 | \keyword{datasets}
38 | \keyword{sf}
39 |
--------------------------------------------------------------------------------
/man/eire.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/eire.R
3 | \docType{data}
4 | \name{eire}
5 | \alias{eire}
6 | \alias{eire.df}
7 | \alias{eire.polys.utm}
8 | \alias{eire.coords.utm}
9 | \alias{eire.nb}
10 | \title{Eire data sets}
11 | \format{
12 | This data frame contains the following columns:
13 | \itemize{
14 | \item{A: Percentage of sample with blood group A}
15 | \item{towns: Towns/unit area}
16 | \item{pale: Beyond the Pale 0, within the Pale 1}
17 | \item{size: number of blood type samples}
18 | \item{ROADACC: arterial road network accessibility in 1961}
19 | \item{OWNCONS: percentage in value terms of gross agricultural output of each county consumed by itself}
20 | \item{POPCHG: 1961 population as percentage of 1926}
21 | \item{RETSALE: value of retail sales British Pound000}
22 | \item{INCOME: total personal income British Pound000}
23 | \item{names: County names}
24 | }
25 | }
26 | \source{
27 | Upton and Fingleton 1985, - Bailey and Gatrell 1995, ch. 1 for blood group data, Cliff and Ord (1973), p. 107 for remaining variables (also after O'Sullivan, 1968). Polygon borders and Irish data sourced from Michael Tiefelsdorf's SPSS Saddlepoint bundle, originally hosted at: http://geog-www.sbs.ohio-state.edu/faculty/tiefelsdorf/GeoStat.htm.
28 | }
29 | \description{
30 | The Eire data set has been converted to shapefile format and placed in the etc/shapes directory. The initial data objects are now stored as a SpatialPolygonsDataFrame object, from which the contiguity neighbour list is recreated. For purposes of record, the original data set is retained.
31 | The \code{eire.df} data frame has 26 rows and 9 columns. In addition, polygons of the 26 counties are provided as a multipart polylist in eire.polys.utm (coordinates in km, projection UTM zone 30). Their centroids are in eire.coords.utm. The original Cliff and Ord binary contiguities are in eire.nb.
32 | }
33 | \examples{
34 | \donttest{
35 | library(spdep)
36 | eire <- sf::st_read(system.file("shapes/eire.gpkg", package="spData")[1])
37 | eire.nb <- poly2nb(eire)
38 |
39 | # Eire physical anthropology blood group data
40 | summary(eire$A)
41 | brks <- round(fivenum(eire$A), digits=2)
42 | cols <- rev(heat.colors(4))
43 | plot(eire, col=cols[findInterval(eire$A, brks, all.inside=TRUE)])
44 | title(main="Percentage with blood group A in Eire")
45 | legend(x=c(-50, 70), y=c(6120, 6050),
46 | c("under 27.91", "27.91 - 29.26", "29.26 - 31.02", "over 31.02"),
47 | fill=cols, bty="n")
48 |
49 | plot(st_geometry(eire))
50 | plot(eire.nb, st_geometry(eire), add=TRUE)
51 |
52 | lA <- lag.listw(nb2listw(eire.nb), eire$A)
53 | summary(lA)
54 | moran.test(eire$A, nb2listw(eire.nb))
55 | geary.test(eire$A, nb2listw(eire.nb))
56 | cor(lA, eire$A)
57 | moran.plot(eire$A, nb2listw(eire.nb), labels=eire$names)
58 | A.lm <- lm(A ~ towns + pale, data=eire)
59 | summary(A.lm)
60 | res <- residuals(A.lm)
61 | brks <- c(min(res),-2,-1,0,1,2,max(res))
62 | cols <- rev(cm.colors(6))
63 |
64 | plot(eire, col=cols[findInterval(res, brks, all.inside=TRUE)])
65 | title(main="Regression residuals")
66 | legend(x=c(-50, 70), y=c(6120, 6050),
67 | legend=c("under -2", "-2 - -1", "-1 - 0", "0 - 1", "1 - 2", "over 2"),
68 | fill=cols, bty="n")
69 |
70 | lm.morantest(A.lm, nb2listw(eire.nb))
71 | lm.morantest.sad(A.lm, nb2listw(eire.nb))
72 | lm.LMtests(A.lm, nb2listw(eire.nb), test="LMerr")
73 |
74 | # Eire agricultural data
75 | brks <- round(fivenum(eire$OWNCONS), digits=2)
76 | cols <- grey(4:1/5)
77 | plot(eire, col=cols[findInterval(eire$OWNCONS, brks, all.inside=TRUE)])
78 | title(main="Percentage own consumption of agricultural produce")
79 | legend(x=c(-50, 70), y=c(6120, 6050),
80 | legend=c("under 9", "9 - 12.2", "12.2 - 19", "over 19"), fill=cols, bty="n")
81 |
82 | moran.plot(eire$OWNCONS, nb2listw(eire.nb))
83 | moran.test(eire$OWNCONS, nb2listw(eire.nb))
84 | e.lm <- lm(OWNCONS ~ ROADACC, data=eire)
85 | res <- residuals(e.lm)
86 | brks <- c(min(res),-2,-1,0,1,2,max(res))
87 | cols <- rev(cm.colors(6))
88 | plot(eire, col=cols[findInterval(res, brks, all.inside=TRUE)])
89 | title(main="Regression residuals")
90 | legend(x=c(-50, 70), y=c(6120, 6050),
91 | legend=c("under -2", "-2 - -1", "-1 - 0", "0 - 1", "1 - 2", "over 2"),
92 | fill=cm.colors(6), bty="n")
93 |
94 | lm.morantest(e.lm, nb2listw(eire.nb))
95 | lm.morantest.sad(e.lm, nb2listw(eire.nb))
96 | lm.LMtests(e.lm, nb2listw(eire.nb), test="LMerr")
97 | print(localmoran.sad(e.lm, eire.nb, select=seq(along=eire.nb)))
98 | }
99 | }
100 | \keyword{datasets}
101 | \keyword{sp}
102 | \keyword{spdep}
103 |
--------------------------------------------------------------------------------
/man/elect80.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/elect80.R
3 | \docType{data}
4 | \name{elect80}
5 | \alias{elect80}
6 | \alias{elect80_lw}
7 | \alias{k4}
8 | \alias{dll}
9 | \alias{e80_queen}
10 | \title{1980 Presidential election results}
11 | \format{
12 | A SpatialPointsDataFrame with 3107 observations on the following 7 variables.
13 | \itemize{
14 | \item{FIPS: a factor of county FIPS codes}
15 | \item{long: a numeric vector of longitude values}
16 | \item{lat: a numeric vector of latitude values}
17 | \item{pc_turnout: Votes cast as proportion of population over age 19 eligible to vote}
18 | \item{pc_college: Population with college degrees as proportion of population over age 19 eligible to vote}
19 | \item{pc_homeownership: Homeownership as proportion of population over age 19 eligible to vote}
20 | \item{pc_income: Income per capita of population over age 19 eligible to vote}
21 | }
22 | }
23 | \source{
24 | Pace, R. Kelley and Ronald Barry. 1997. "Quick Computation of Spatial Autoregressive Estimators", in Geographical Analysis; sourced from the data folder in the Spatial Econometrics Toolbox for Matlab, formerly available from http://www.spatial-econometrics.com/html/jplv7.zip, files \code{elect.dat} and \code{elect.ford} (with the final line dropped).
25 | }
26 | \usage{
27 | elect80
28 | }
29 | \description{
30 | A data set for 1980 Presidential election results covering 3,107 US counties using geographical coordinates. In addition, three spatial neighbour objects, \code{k4} not using Great Circle distances, \code{dll} using Great Circle distances, and \code{e80_queen} of Queen contiguities for equivalent County polygons taken from file \code{co1980p020.tar.gz} on the USGS National Atlas site, and a spatial weights object imported from \code{elect.ford} - a 4-nearest neighbour non-GC row-standardised object, but with coercion to symmetry.
31 | }
32 | \examples{
33 | if (requireNamespace("sp", quietly = TRUE)) {
34 | library(sp)
35 | data(elect80)
36 | summary(elect80)
37 | plot(elect80)
38 | }
39 | }
40 | \keyword{datasets}
41 | \keyword{sp}
42 |
--------------------------------------------------------------------------------
/man/elev.tif.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/elev.R
3 | \docType{data}
4 | \name{elev.tif}
5 | \alias{elev.tif}
6 | \title{Artificial elevation raster data set}
7 | \description{
8 | The raster data represents elevation in meters and uses WGS84 as
9 | a coordinate reference system.
10 | }
11 | \examples{
12 | system.file("raster/elev.tif", package = "spData")
13 | }
14 | \keyword{datasets}
15 | \keyword{raster}
16 |
--------------------------------------------------------------------------------
/man/figures/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Nowosad/spData/eeb5d38f3dfd9a4abd100c5c564a6801e0d0a80c/man/figures/logo.png
--------------------------------------------------------------------------------
/man/getisord.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/getisord.R
3 | \docType{data}
4 | \name{getisord}
5 | \alias{getisord}
6 | \alias{go_x}
7 | \alias{go_y}
8 | \alias{go_xyz}
9 | \title{Getis-Ord remote sensing example data}
10 | \format{
11 | This data frame contains the following columns:
12 | \itemize{
13 | \item{x: grid eastings}
14 | \item{y: grid northings}
15 | \item{val: remote sensing values}
16 | }
17 | }
18 | \source{
19 | Getis, A. and Ord, J. K. 1996 Local spatial statistics: an overview. In P. Longley and M. Batty (eds) \emph{Spatial analysis: modelling in a GIS environment} (Cambridge: Geoinformation International), 266.
20 | }
21 | \description{
22 | The \code{go_xyz} data frame has 256 rows and 3 columns. Vectors \code{go_x} and \code{go_y} are of length 16 and give the centres of the grid rows and columns, 30m apart. The data start from the bottom left, Getis and Ord start from the top left - so their 136th grid cell is our 120th.
23 | }
24 | \examples{
25 | data(getisord)
26 | image(go_x, go_y, t(matrix(go_xyz$val, nrow = 16, ncol=16, byrow = TRUE)), asp = 1)
27 | text(go_xyz$x, go_xyz$y, go_xyz$val, cex = 0.7)
28 | polygon(c(195, 225, 225, 195), c(195, 195, 225, 225), lwd = 2)
29 | title(main = "Getis-Ord 1996 remote sensing data")
30 |
31 | }
32 | \keyword{datasets}
33 | \keyword{misc}
34 |
--------------------------------------------------------------------------------
/man/grain.tif.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/grain.R
3 | \docType{data}
4 | \name{grain.tif}
5 | \alias{grain.tif}
6 | \title{Artificial raster dataset representing grain sizes}
7 | \description{
8 | The ratified raster dataset represents grain sizes with the
9 | three classes clay, silt and sand, and WGS84 as a coordinate reference
10 | system.
11 | }
12 | \examples{
13 | system.file("raster/grain.tif", package = "spData")
14 | }
15 | \keyword{datasets}
16 | \keyword{raster}
17 |
--------------------------------------------------------------------------------
/man/hawaii.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/hawaii.R
3 | \docType{data}
4 | \name{hawaii}
5 | \alias{hawaii}
6 | \title{Hawaii multipolygon}
7 | \format{
8 | Formal class 'sf' [package "sf"]; the data contains a data.frame with 1 obs. of 7 variables:
9 | \itemize{
10 | \item{GEOID: character vector of geographic identifiers}
11 | \item{NAME: character vector of state names}
12 | \item{REGION: character vector of region names}
13 | \item{AREA: area in square kilometers of units class}
14 | \item{total_pop_10: numerical vector of total population in 2010}
15 | \item{total_pop_15: numerical vector of total population in 2015}
16 | \item{geometry: sfc_MULTIPOLYGON}
17 | }
18 | The object is in projected coordinates using Hawaii Albers Equal Area Conic (ESRI:102007).
19 | }
20 | \source{
21 | \url{https://www.census.gov/geographies/mapping-files/time-series/geo/tiger-line-file.html}
22 | }
23 | \usage{
24 | hawaii
25 | }
26 | \description{
27 | The object loaded is a \code{sf} object containing the state of
28 | Hawaii from the US Census Bureau
29 | with a few variables from American Community Survey (ACS)
30 | }
31 | \examples{
32 | if (requireNamespace("sf", quietly = TRUE)) {
33 | library(sf)
34 | data(hawaii)
35 |
36 | plot(hawaii["total_pop_15"])
37 | }
38 | }
39 | \seealso{
40 | See the tigris package: https://cran.r-project.org/package=tigris
41 | }
42 | \keyword{datasets}
43 | \keyword{sf}
44 |
--------------------------------------------------------------------------------
/man/hopkins.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/hopkins.R
3 | \docType{data}
4 | \name{hopkins}
5 | \alias{hopkins}
6 | \title{Hopkins burnt savanna herb remains}
7 | \format{
8 | num [1:40, 1:40] 0 0 0 0 0 0 0 0 0 1 ...
9 | }
10 | \source{
11 | Upton, G., Fingleton, B. 1985 Spatial data analysis by example: point pattern and quatitative data, Wiley, pp. 38--39.
12 | }
13 | \usage{
14 | hopkins
15 | }
16 | \description{
17 | A 20m square is divided into 40 by 40 0.5m quadrats. Observations are in tens of grams of herb remains, 0 being from 0g to less than 10g, and so on. Analysis was mostly conducted using the interior 32 by 32 grid.
18 | }
19 | \examples{
20 | data(hopkins)
21 | image(1:32, 1:32, hopkins[5:36,36:5], breaks=c(-0.5, 3.5, 20),
22 | col=c("white", "black"))
23 | }
24 | \references{
25 | Hopkins, B., 1965 Observations on savanna burning in the Olokemeji Forest Reserve, Nigeria. Journal of Applied Ecology, 2, 367--381.
26 | }
27 | \keyword{datasets}
28 | \keyword{misc}
29 |
--------------------------------------------------------------------------------
/man/house.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/house.R
3 | \docType{data}
4 | \name{house}
5 | \alias{house}
6 | \alias{LO_nb}
7 | \alias{trMat}
8 | \title{Lucas county OH housing}
9 | \format{
10 | Formal class 'SpatialPointsDataFrame' [package "sp"] with 5 slots. The data slot is a data frame with 25357 observations on the following 24 variables.
11 | \itemize{
12 | \item{price: a numeric vector}
13 | \item{yrbuilt: a numeric vector}
14 | \item{stories: a factor with levels \code{one} \code{bilevel} \code{multilvl} \code{one+half} \code{two} \code{two+half} \code{three}}
15 | \item{TLA: a numeric vector}
16 | \item{wall: a factor with levels \code{stucdrvt} \code{ccbtile} \code{metlvnyl} \code{brick} \code{stone} \code{wood} \code{partbrk}}
17 | \item{beds: a numeric vector}
18 | \item{baths: a numeric vector}
19 | \item{halfbaths: a numeric vector}
20 | \item{frontage: a numeric vector}
21 | \item{depth: a numeric vector}
22 | \item{garage: a factor with levels \code{no garage} \code{basement} \code{attached} \code{detached} \code{carport}}
23 | \item{garagesqft: a numeric vector}
24 | \item{rooms: a numeric vector}
25 | \item{lotsize: a numeric vector}
26 | \item{sdate: a numeric vector}
27 | \item{avalue: a numeric vector}
28 | \item{s1993: a numeric vector}
29 | \item{s1994: a numeric vector}
30 | \item{s1995: a numeric vector}
31 | \item{s1996: a numeric vector}
32 | \item{s1997: a numeric vector}
33 | \item{s1998: a numeric vector}
34 | \item{syear: a factor with levels \code{1993} \code{1994} \code{1995} \code{1996} \code{1997} \code{1998}}
35 | \item{age: a numeric vector}
36 | }
37 | Its projection is \code{CRS(+init=epsg:2834)}, the Ohio North State Plane.
38 | }
39 | \source{
40 | Dataset included in the Spatial Econometrics toolbox for Matlab, formerly available from http://www.spatial-econometrics.com/html/jplv7.zip.
41 | }
42 | \usage{
43 | house
44 | }
45 | \description{
46 | Data on 25,357 single family homes sold in Lucas County, Ohio, 1993-1998 from the county auditor, together with an \code{nb} neighbour object constructed as a sphere of influence graph from projected coordinates.
47 | }
48 | \examples{
49 | if (requireNamespace("sp", quietly = TRUE)) {
50 | library(sp)
51 | data(house)
52 | str(house)
53 | plot(house)
54 | }
55 | }
56 | \keyword{datasets}
57 | \keyword{sp}
58 |
--------------------------------------------------------------------------------
/man/huddersfield.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/huddersfield.R
3 | \docType{data}
4 | \name{huddersfield}
5 | \alias{huddersfield}
6 | \title{Prevalence of respiratory symptoms}
7 | \format{
8 | A data frame with 71 observations on the following 2 variables.
9 | \itemize{
10 | \item{\code{cases}: Prevalence of at least mild conditions}
11 | \item{\code{total}: Number of questionnaires returned}
12 | }
13 | }
14 | \source{
15 | Martuzzi M, Elliott P (1996) Empirical Bayes estimation of small area prevalence of non-rare conditions, Statistics in Medicine 15, 1867--1873, pp. 1870--1871.
16 | }
17 | \usage{
18 | huddersfield
19 | }
20 | \description{
21 | Prevalence of respiratory symptoms in 71 school catchment areas in Huddersfield, Northern England
22 | }
23 | \examples{
24 | data(huddersfield)
25 | str(huddersfield)
26 | }
27 | \keyword{datasets}
28 | \keyword{misc}
29 |
--------------------------------------------------------------------------------
/man/jenks71.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/jenks71.R
3 | \docType{data}
4 | \name{jenks71}
5 | \alias{jenks71}
6 | \title{Illinois 1959 county gross farm product value per acre}
7 | \format{
8 | A data frame with 102 observations on the following 2 variables.
9 | \itemize{
10 | \item{\code{jenks71}: a numeric vector: Per acre value of gross farm products in dollars by county for Illinois in #' 1959}
11 | \item{\code{area}: a numeric vector: county area in square miles}
12 | }
13 | }
14 | \source{
15 | Jenks, G. F., Caspall, F. C., 1971. "Error on choroplethic maps: definition, measurement, reduction". Annals, Association of American Geographers, 61 (2), 217--244
16 | }
17 | \usage{
18 | jenks71
19 | }
20 | \description{
21 | Classic data set for the choice of class intervals for choropleth maps.
22 | }
23 | \examples{
24 | data(jenks71)
25 | jenks71
26 | }
27 | \keyword{datasets}
28 | \keyword{misc}
29 |
--------------------------------------------------------------------------------
/man/lnd.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/lnd.R
3 | \docType{data}
4 | \name{lnd}
5 | \alias{lnd}
6 | \title{The boroughs of London}
7 | \format{
8 | \itemize{
9 | \item{NAME: Borough name}
10 | \item{GSS_CODE: Official code}
11 | \item{HECTARES: How many hectares}
12 | \item{NONLD_AREA: Area outside London}
13 | \item{ONS_INNER: Office for national statistics code}
14 | \item{SUB_2009: Empty column}
15 | \item{SUB_2006: Empty column}
16 | \item{geometry: sfc_MULTIPOLYGON}
17 | }
18 | }
19 | \source{
20 | \url{https://github.com/Robinlovelace/Creating-maps-in-R}
21 | }
22 | \usage{
23 | lnd
24 | }
25 | \description{
26 | Polygons representing large administrative zones in London
27 | }
28 | \examples{
29 | if (requireNamespace("sf", quietly = TRUE)) {
30 | library(sf)
31 | data(lnd)
32 | summary(lnd)
33 | plot(st_geometry(lnd))
34 | }
35 | }
36 | \keyword{datasets}
37 | \keyword{sf}
38 |
--------------------------------------------------------------------------------
/man/nc.sids.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/nc.sids.R
3 | \docType{data}
4 | \name{nc.sids}
5 | \alias{nc.sids}
6 | \alias{ncCR85.nb}
7 | \alias{ncCC89.nb}
8 | \alias{sidspolys}
9 | \alias{sidscents}
10 | \title{North Carolina SIDS data}
11 | \format{
12 | This data frame contains the following columns:
13 | \itemize{
14 | \item{SP_ID: SpatialPolygons ID}
15 | \item{CNTY_ID: county ID}
16 | \item{east: eastings, county seat, miles, local projection}
17 | \item{north: northings, county seat, miles, local projection}
18 | \item{L_id: Cressie and Read (1985) L index}
19 | \item{M_id: Cressie and Read (1985) M index}
20 | \item{names: County names}
21 | \item{AREA: County polygon areas in degree units}
22 | \item{PERIMETER: County polygon perimeters in degree units}
23 | \item{CNTY_: Internal county ID}
24 | \item{NAME: County names}
25 | \item{FIPS: County ID}
26 | \item{FIPSNO: County ID}
27 | \item{CRESS_ID: Cressie papers ID}
28 | \item{BIR74: births, 1974-78}
29 | \item{SID74: SID deaths, 1974-78}
30 | \item{NWBIR74: non-white births, 1974-78}
31 | \item{BIR79: births, 1979-84}
32 | \item{SID79: SID deaths, 1979-84}
33 | \item{NWBIR79: non-white births, 1979-84}
34 | }
35 | }
36 | \source{
37 | Cressie, N (1991), \emph{Statistics for spatial data}. New York: Wiley, pp. 386--389; Cressie, N, Chan NH (1989) Spatial modelling of regional variables. \emph{Journal of the American Statistical Association}, 84, 393--401; Cressie, N, Read, TRC (1985) Do sudden infant deaths come in clusters? \emph{Statistics and Decisions} Supplement Issue 2, 333--349; http://sal.agecon.uiuc.edu/datasets/sids.zip.
38 | }
39 | \usage{
40 | nc.sids
41 | }
42 | \description{
43 | (Use \code{example(nc.sids)} to read the data set from shapefile, together with import of two different list of neighbours).
44 | The \code{nc.sids} data frame has 100 rows and 21 columns. It contains data given in Cressie (1991, pp. 386-9), Cressie and Read (1985) and Cressie and Chan (1989) on sudden infant deaths in North Carolina for 1974-78 and 1979-84. The data set also contains the neighbour list given by Cressie and Chan (1989) omitting self-neighbours (ncCC89.nb), and the neighbour list given by Cressie and Read (1985) for contiguities (ncCR85.nb). The data are ordered by county ID number, not alphabetically as in the source tables \code{sidspolys} is a "polylist" object of polygon boundaries, and \code{sidscents} is a matrix of their centroids.
45 | }
46 | \examples{
47 | if (requireNamespace("sf", quietly = TRUE)) {
48 | if (requireNamespace("spdep", quietly = TRUE)) {
49 | library(spdep)
50 | nc.sids <- sf::st_read(system.file("shapes/sids.gpkg", package="spData")[1])
51 | row.names(nc.sids) <- as.character(nc.sids$FIPS)
52 | rn <- row.names(nc.sids)
53 | ncCC89_nb <- read.gal(system.file("weights/ncCC89.gal", package="spData")[1],
54 | region.id=rn)
55 | ncCR85_nb <- read.gal(system.file("weights/ncCR85.gal", package="spData")[1],
56 | region.id=rn)
57 |
58 | plot(sf::st_geometry(nc.sids), border="grey")
59 | plot(ncCR85_nb, sf::st_geometry(nc.sids), add=TRUE, col="blue")
60 | plot(sf::st_geometry(nc.sids), border="grey")
61 | plot(ncCC89_nb, sf::st_geometry(nc.sids), add=TRUE, col="blue")
62 | }
63 | }
64 | }
65 | \keyword{datasets}
66 | \keyword{spdep}
67 |
--------------------------------------------------------------------------------
/man/nydata.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/nydata.R
3 | \docType{data}
4 | \name{nydata}
5 | \alias{nydata}
6 | \alias{NY_data}
7 | \alias{listw_NY}
8 | \title{New York leukemia data}
9 | \format{
10 | A data frame with 281 observations on the following 12 variables, and the binary coded spatial weights used in the source.
11 | \itemize{
12 | \item{AREANAME: name of census tract}
13 | \item{AREAKEY: unique FIPS code for each tract}
14 | \item{X: x-coordinate of tract centroid (in km)}
15 | \item{Y: y-coordinate of tract centroid (in km)}
16 | \item{POP8: population size (1980 U.S. Census)}
17 | \item{TRACTCAS: number of cases 1978-1982}
18 | \item{PROPCAS: proportion of cases per tract}
19 | \item{PCTOWNHOME: percentage of people in each tract owning their own home}
20 | \item{PCTAGE65P: percentage of people in each tract aged 65 or more}
21 | \item{Z: ransformed propoprtions}
22 | \item{AVGIDIST: average distance between centroid and TCE sites}
23 | \item{PEXPOSURE: "exposure potential": inverse distance between each census tract centroid and the nearest TCE site, IDIST, transformed via log(100*IDIST)}
24 | \item{Cases: as TRACTCAS with more digits}
25 | \item{Xm: X in metres}
26 | \item{Ym: Y in metres}
27 | \item{Xshift: feature offset}
28 | \item{Yshift: feature offset}
29 | }
30 | }
31 | \source{
32 | http://www.sph.emory.edu/~lwaller/ch9index.htm
33 | }
34 | \usage{
35 | nydata
36 | }
37 | \description{
38 | New York leukemia data taken from the data sets supporting Waller and Gotway 2004 (the data should be loaded by running \code{example(NY_data)} to demonstrate spatial data import techniques)
39 | }
40 | \details{
41 | The examples section shows how the DBF files from the book website for Chapter 9 were converted into the \code{nydata} data frame and the \code{listw_NY} spatial weights list. The \code{shapes} directory includes the original version of the UTM18 census tract boundaries imported from BNA format (http://sedac.ciesin.columbia.edu/ftpsite/pub/census/usa/tiger/ny/bna_st/t8_36.zip) before the OGR/GDAL BNA driver was available. The \code{NY8_utm18} shapefile was constructed using a bna2mif converter and converted to shapefile format after adding data using \code{writeOGR}. The new file \code{NY8_bna_utm18.gpkg} has been constructed from the original BNA file, but read using the OGR BNA driver with GEOS support. The NY8 shapefile and GeoPackage NY8_utm18.gpkg include invalid polygons, but because the OGR BNA driver may have GEOS support (used here), the tract polygon objects in NY8_bna_utm18.gpkg are valid.
42 | }
43 | \examples{
44 | ## NY leukemia
45 | \donttest{
46 | if (requireNamespace("sf", quietly = TRUE)) {
47 | library(foreign)
48 | nydata <- read.dbf(system.file("misc/nydata.dbf", package="spData")[1])
49 | nydata <- sf::st_as_sf(nydata, coords=c("X", "Y"), remove=FALSE)
50 | plot(sf::st_geometry(nydata))
51 |
52 | nyadjmat <- as.matrix(read.dbf(system.file("misc/nyadjwts.dbf",
53 | package="spData")[1])[-1])
54 | ID <- as.character(names(read.dbf(system.file("misc/nyadjwts.dbf",
55 | package="spData")[1]))[-1])
56 | identical(substring(ID, 2, 10), substring(as.character(nydata$AREAKEY), 2, 10))
57 |
58 | if (requireNamespace("sf", quietly = TRUE)) {
59 | library(spdep)
60 | listw_NY <- mat2listw(nyadjmat, as.character(nydata$AREAKEY), style="B")
61 | }
62 | }
63 | }
64 | }
65 | \references{
66 | Waller, L. and C. Gotway (2004) \emph{Applied Spatial Statistics for Public Health Data}. New York: John Wiley and Sons.
67 | }
68 | \keyword{datasets}
69 | \keyword{foreign}
70 | \keyword{spdep}
71 |
--------------------------------------------------------------------------------
/man/nz.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/nz.R
3 | \docType{data}
4 | \name{nz}
5 | \alias{nz}
6 | \alias{new_zealand}
7 | \title{Regions in New Zealand}
8 | \format{
9 | FORMAT:
10 | \itemize{
11 | \item{Name: Name}
12 | \item{Island: Island}
13 | \item{Land_area: Land area}
14 | \item{Population: Population}
15 | \item{Median_income: Median income (NZD)}
16 | \item{Sex_ratio: Sex ratio (male/female)}
17 | \item{geom: sfc_MULTIPOLYGON}
18 | }
19 | }
20 | \source{
21 | \url{https://www.stats.govt.nz}
22 |
23 | \url{https://en.wikipedia.org/wiki/Regions_of_New_Zealand}
24 | }
25 | \usage{
26 | nz
27 | }
28 | \description{
29 | Polygons representing the 16 regions of New Zealand (2018).
30 | See \url{https://en.wikipedia.org/wiki/Regions_of_New_Zealand} for a description of these regions
31 | and \url{https://www.stats.govt.nz} for information on the data source
32 | }
33 | \examples{
34 | if (requireNamespace("sf", quietly = TRUE)) {
35 | library(sf)
36 | summary(nz)
37 | plot(nz)
38 | }
39 | \dontrun{
40 | # Find "Regional Council 2018 Clipped (generalised)"
41 | # select the GeoPackage option in the "Vectors/tables" dropdown
42 | # at https://datafinder.stats.govt.nz/data/ (requires registration)
43 | # Save the result as:
44 | unzip("statsnzregional-council-2018-clipped-generalised-GPKG.zip")
45 | library(sf)
46 | library(tidyverse)
47 | nz_full = st_read("regional-council-2018-clipped-generalised.gpkg")
48 | print(object.size(nz_full), units = "Kb") # 14407.2 Kb
49 | nz = rmapshaper::ms_simplify(nz_full, keep = 0.001, sys = TRUE)
50 | print(object.size(nz), units = "Kb") # 39.9 Kb
51 | names(nz)
52 | nz$REGC2018_V1_00_NAME
53 | nz = filter(nz, REGC2018_V1_00_NAME != "Area Outside Region") \%>\%
54 | select(Name = REGC2018_V1_00_NAME, `Land_area` = LAND_AREA_SQ_KM)
55 | # regions basic info
56 | # devtools::install_github("hadley/rvest")
57 | library(rvest)
58 | doc = read_html("https://en.wikipedia.org/wiki/Regions_of_New_Zealand") \%>\%
59 | html_nodes("div table")
60 | tab = doc[[3]] \%>\% html_table()
61 | tab = tab \%>\% select(Name = Region, Population = `Population[20]`, Island)
62 | tab = tab \%>\% mutate(Population = str_replace_all(Population, ",", "")) \%>\%
63 | mutate(Population = as.numeric(Population)) \%>\%
64 | mutate(Name = str_remove_all(Name, " \\\\([1-9]\\\\)?.+"))
65 | nz$Name = as.character(nz$Name)
66 | nz$Name = str_remove(nz$Name, " Region")
67 | nz$Name \%in\% tab$Name
68 | # regions additional info
69 | library(nzcensus)
70 | nz_add_data = REGC2013 \%>\%
71 | select(Name = REGC2013_N, Median_income = MedianIncome2013,
72 | PropFemale2013, PropMale2013) \%>\%
73 | mutate(Sex_ratio = PropMale2013 / PropFemale2013) \%>\%
74 | mutate(Name = gsub(" Region", "", Name)) \%>\%
75 | select(Name, Median_income, Sex_ratio)
76 | # data join
77 | nz = left_join(nz, tab, by = "Name") \%>\%
78 | left_join(nz_add_data, by = "Name") \%>\%
79 | select(Name, Island, Land_area, Population, Median_income, Sex_ratio)
80 | }
81 | }
82 | \seealso{
83 | See the nzcensus package: https://github.com/ellisp/nzelect
84 | }
85 | \keyword{datasets}
86 | \keyword{sf}
87 |
--------------------------------------------------------------------------------
/man/nz_height.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/nz_height.R
3 | \docType{data}
4 | \name{nz_height}
5 | \alias{nz_height}
6 | \title{High points in New Zealand}
7 | \format{
8 | FORMAT:
9 | \itemize{
10 | \item{t50_fid: ID}
11 | \item{elevation: Height above sea level in m}
12 | \item{geometry: sfc_POINT}
13 | }
14 | }
15 | \source{
16 | \url{https://data.linz.govt.nz}
17 | }
18 | \usage{
19 | nz_height
20 | }
21 | \description{
22 | Top 101 heighest points in New Zealand (2017).
23 | See \url{https://data.linz.govt.nz/layer/50284-nz-height-points-topo-150k/} for details.
24 | }
25 | \examples{
26 | if (requireNamespace("sf", quietly = TRUE)) {
27 | library(sf)
28 | summary(nz_height)
29 | plot(nz$geom)
30 | plot(nz_height$geom, add = TRUE)
31 | }
32 | \dontrun{
33 | library(dplyr)
34 | # After downloading data
35 | unzip("lds-nz-height-points-topo-150k-SHP.zip")
36 | nz_height = st_read("nz-height-points-topo-150k.shp") \%>\%
37 | top_n(n = 100, wt = elevation)
38 | library(tmap)
39 | tmap_mode("view")
40 | qtm(nz) +
41 | qtm(nz_height)
42 | f = list.files(pattern = "*nz-height*")
43 | file.remove(f)
44 | }
45 | }
46 | \keyword{datasets}
47 | \keyword{sf}
48 |
--------------------------------------------------------------------------------
/man/properties.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/properties.R
3 | \docType{data}
4 | \name{properties}
5 | \alias{properties}
6 | \title{Dataset of properties in the municipality of Athens (sf)}
7 | \format{
8 | An sf object of 1000 points with the following 6 variables.
9 | \itemize{
10 | \item{id: An unique identifier for each property.}
11 | \item{size : The size of the property (unit: square meters)}
12 | \item{price : The asking price (unit: euros) }
13 | \item{prpsqm : The asking price per squre meter (unit: euroes/square meter).}
14 | \item{age : Age of property in 2017 (unit: years).}
15 | \item{dist_metro: The distance to closest train/metro station (unit: meters).}
16 | }
17 | }
18 | \usage{
19 | properties
20 | }
21 | \description{
22 | A dataset of apartments in the municipality of Athens for 2017. Point location of the properties is given together with their main characteristics and the distance to the closest metro/train station.
23 | }
24 | \examples{
25 | if (requireNamespace("sf", quietly = TRUE)) {
26 | if (requireNamespace("spdep", quietly = TRUE)) {
27 | library(sf)
28 | library(spdep)
29 |
30 | data(properties)
31 |
32 | summary(properties$prpsqm)
33 |
34 | pr.nb.800 <- dnearneigh(properties, 0, 800)
35 | pr.listw <- nb2listw(pr.nb.800)
36 |
37 | moran.test(properties$prpsqm, pr.listw)
38 | moran.plot(properties$prpsqm, pr.listw, xlab = "Price/m^2", ylab = "Lagged")
39 | }
40 | }
41 | }
42 | \seealso{
43 | depmunic
44 | }
45 | \keyword{data}
46 | \keyword{datasets}
47 | \keyword{hierarchical}
48 | \keyword{sf}
49 | \keyword{spatial}
50 |
--------------------------------------------------------------------------------
/man/seine.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/seine.R
3 | \docType{data}
4 | \name{seine}
5 | \alias{seine}
6 | \alias{rivers}
7 | \title{Small river network in France}
8 | \format{
9 | FORMAT:
10 | \itemize{
11 | \item{name: name}
12 | \item{geometry: sfc_MULTILINESTRING}
13 | }
14 | The object is in the RGF93 / Lambert-93 CRS.
15 | }
16 | \source{
17 | \url{https://www.naturalearthdata.com/}
18 | }
19 | \usage{
20 | seine
21 | }
22 | \description{
23 | Lines representing the Seine, Marne and Yonne rivers.
24 | }
25 | \examples{
26 | if (requireNamespace("sf", quietly = TRUE)) {
27 | library(sf)
28 | seine
29 | plot(seine)
30 | }
31 | \dontrun{
32 | library(sf)
33 | library(rnaturalearth)
34 | library(tidyverse)
35 |
36 | seine = ne_download(scale = 10, type = "rivers_lake_centerlines",
37 | category = "physical", returnclass = "sf") \%>\%
38 | filter(name \%in\% c("Yonne", "Seine", "Marne")) \%>\%
39 | select(name = name_en) \%>\%
40 | st_transform(2154)
41 | }
42 | }
43 | \seealso{
44 | See the rnaturalearth package: https://cran.r-project.org/package=rnaturalearth
45 | }
46 | \keyword{datasets}
47 | \keyword{sf}
48 |
--------------------------------------------------------------------------------
/man/state.vbm.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/state.vbm.R
3 | \docType{data}
4 | \name{state.vbm}
5 | \alias{state.vbm}
6 | \title{US State Visibility Based Map}
7 | \format{
8 | An object of class \code{SpatialPolygonsDataFrame} with 50 rows and 2 columns.
9 | }
10 | \source{
11 | The data was converted from the maps library for S-PLUS. S-PLUS uses the map with permission from the author. This version of the data has not received permission from the author (no attempt made, not that it was refused), most of my uses I feel fall under fair use and do not violate copyright, but you will need to decide for yourself and your applications.
12 | }
13 | \usage{
14 | state.vbm
15 | }
16 | \description{
17 | A SpatialPolygonsDataFrame object to plot a Visibility Based Map.
18 | }
19 | \details{
20 | A SpatialPolygonsDataFrame object to plot a map of the US states where the sizes of the states have been adjusted to be more equal.
21 | This map can be useful for plotting state data using colors patterns without the larger states dominating and the smallest states being lost.
22 | The original map is copyrighted by Mark Monmonier. Official publications based on this map should acknowledge him. Comercial publications of maps based on this probably need permission from him to use.
23 | }
24 | \examples{
25 | if (requireNamespace("sp", quietly = TRUE)) {
26 | library(sp)
27 | data(state.vbm)
28 | plot(state.vbm)
29 |
30 | tmp <- state.x77[, 'HS Grad']
31 | tmp2 <- cut(tmp, seq(min(tmp), max(tmp), length.out=11),
32 | include.lowest=TRUE)
33 | plot(state.vbm, col=cm.colors(10)[tmp2])
34 | }
35 | }
36 | \references{
37 | \url{http://www.markmonmonier.com/index.htm},
38 | \url{http://euclid.psych.yorku.ca/SCS/Gallery/bright-ideas.html}
39 | }
40 | \author{
41 | Greg Snow \email{greg.snow@imail.org} (of this compilation)
42 | }
43 | \keyword{datasets}
44 | \keyword{sp}
45 |
--------------------------------------------------------------------------------
/man/urban_agglomerations.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/urban_agglomerations.R
3 | \docType{data}
4 | \name{urban_agglomerations}
5 | \alias{urban_agglomerations}
6 | \title{Major urban areas worldwide}
7 | \format{
8 | Selected variables:
9 | \itemize{
10 | \item{year: Year of population estimate}
11 | \item{country_code: Code of country}
12 | \item{urban_agglomeration: Name of the urban agglomeration}
13 | \item{population_millions: Estimated human population}
14 | \item{geometry: sfc_POINT}
15 | }
16 | }
17 | \usage{
18 | urban_agglomerations
19 | }
20 | \description{
21 | Dataset in a 'long' form from the United Nations
22 | population division with projections up to 2050.
23 | Includes only the top 30 largest areas by population at 5 year intervals.
24 | }
25 | \examples{
26 | if (requireNamespace("sf", quietly = TRUE)) {
27 | library(sf)
28 | plot(urban_agglomerations)
29 | }
30 | # Code used to download the data:
31 | \dontrun{
32 | f = "WUP2018-F11b-30_Largest_Cities_in_2018_by_time.xls"
33 | download.file(
34 | destfile = f,
35 | url = paste0("https://population.un.org/wup/Download/Files/", f)
36 | )
37 | library(dplyr)
38 | library(sf)
39 | urban_agglomerations = readxl::read_excel(f, skip = 16) \%>\%
40 | st_as_sf(coords = c("Longitude", "Latitude"), crs = 4326)
41 | names(urban_agglomerations)
42 | names(urban_agglomerations) <- gsub(" |\\\\n", "_", tolower(names(urban_agglomerations)) ) \%>\%
43 | gsub("\\\\(|\\\\)", "", .)
44 | names(urban_agglomerations)
45 | urban_agglomerations
46 | usethis::use_data(urban_agglomerations, overwrite = TRUE)
47 | file.remove("WUP2018-F11b-30_Largest_Cities_in_2018_by_time.xls")
48 | }
49 | }
50 | \keyword{datasets}
51 | \keyword{sf}
52 |
--------------------------------------------------------------------------------
/man/us_states.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/us_states.R
3 | \docType{data}
4 | \name{us_states}
5 | \alias{us_states}
6 | \title{US states polygons}
7 | \format{
8 | Formal class 'sf' [package "sf"]; the data contains a data.frame with 49 obs. of 7 variables:
9 | \itemize{
10 | \item{GEOID: character vector of geographic identifiers}
11 | \item{NAME: character vector of state names}
12 | \item{REGION: character vector of region names}
13 | \item{AREA: area in square kilometers of units class}
14 | \item{total_pop_10: numerical vector of total population in 2010}
15 | \item{total_pop_15: numerical vector of total population in 2015}
16 | \item{geometry: sfc_MULTIPOLYGON}
17 | }
18 | The object is in geographical coordinates using the NAD83 datum.
19 | }
20 | \source{
21 | \url{https://www.census.gov/geographies/mapping-files/time-series/geo/tiger-line-file.html}
22 | }
23 | \usage{
24 | us_states
25 | }
26 | \description{
27 | The object loaded is a \code{sf} object containing the contiguous United States data from the US Census Bureau
28 | with a few variables from American Community Survey (ACS)
29 | }
30 | \examples{
31 | if (requireNamespace("sf", quietly = TRUE)) {
32 | library(sf)
33 | data(us_states)
34 |
35 | plot(us_states["REGION"])
36 | }
37 | }
38 | \seealso{
39 | See the tigris package: https://cran.r-project.org/package=tigris
40 | }
41 | \keyword{datasets}
42 | \keyword{sf}
43 |
--------------------------------------------------------------------------------
/man/us_states_df.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/us_states_df.R
3 | \docType{data}
4 | \name{us_states_df}
5 | \alias{us_states_df}
6 | \title{the American Community Survey (ACS) data}
7 | \format{
8 | Formal class 'data.frame'; the data contains a data.frame with 51 obs. of 5 variables:
9 | \itemize{
10 | \item{state: character vector of state names}
11 | \item{median_income_10: numerical vector of median income in 2010}
12 | \item{median_income_15: numerical vector of median income in 2010}
13 | \item{poverty_level_10: numerical vector of number of people with income below poverty level in 2010}
14 | \item{poverty_level_15: numerical vector of number of people with income below poverty level in 2015}
15 | }
16 | }
17 | \source{
18 | \url{https://www.census.gov/programs-surveys/acs/}
19 | }
20 | \usage{
21 | us_states_df
22 | }
23 | \description{
24 | The object loaded is a \code{data.frame} object containing the US states data from the American Community Survey (ACS)
25 | }
26 | \examples{
27 | data(us_states_df)
28 |
29 | summary(us_states_df)
30 |
31 | }
32 | \seealso{
33 | See the tidycensus package: https://cran.r-project.org/package=tidycensus
34 | }
35 | \keyword{datasets}
36 |
--------------------------------------------------------------------------------
/man/used.cars.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/used.cars.R
3 | \docType{data}
4 | \name{used.cars}
5 | \alias{used.cars}
6 | \alias{usa48.nb}
7 | \title{US 1960 used car prices}
8 | \format{
9 | This data frame contains the following columns:
10 | \itemize{
11 | \item{tax.charges: taxes and delivery charges for 1955-9 new cars}
12 | \item{price.1960: 1960 used car prices by state}
13 | }
14 | }
15 | \source{
16 | Hanna, F. A. 1966 Effects of regional differences in taxes and transport charges on automobile consumption, in Ostry, S., Rhymes, J. K. (eds) Papers on regional statistical studies, Toronto: Toronto University Press, pp. 199-223.
17 | }
18 | \usage{
19 | used.cars
20 | }
21 | \description{
22 | The \code{used.cars} data frame has 48 rows and 2 columns. The data set includes a neighbours list for the 48 states excluding DC from poly2nb().
23 | }
24 | \examples{
25 | if (requireNamespace("spdep", quietly = TRUE)) {
26 | library(spdep)
27 | data(used.cars)
28 | moran.test(used.cars$price.1960, nb2listw(usa48.nb))
29 | moran.plot(used.cars$price.1960, nb2listw(usa48.nb),
30 | labels=rownames(used.cars))
31 | uc.lm <- lm(price.1960 ~ tax.charges, data=used.cars)
32 | summary(uc.lm)
33 |
34 | lm.morantest(uc.lm, nb2listw(usa48.nb))
35 | lm.morantest.sad(uc.lm, nb2listw(usa48.nb))
36 | lm.LMtests(uc.lm, nb2listw(usa48.nb))
37 | \donttest{
38 | if (requireNamespace("spatialreg", quietly = TRUE)) {
39 | library(spatialreg)
40 | uc.err <- errorsarlm(price.1960 ~ tax.charges, data=used.cars,
41 | nb2listw(usa48.nb), tol.solve=1.0e-13,
42 | control=list(tol.opt=.Machine$double.eps^0.3))
43 | summary(uc.err)
44 | uc.lag <- lagsarlm(price.1960 ~ tax.charges, data=used.cars,
45 | nb2listw(usa48.nb), tol.solve=1.0e-13,
46 | control=list(tol.opt=.Machine$double.eps^0.3))
47 | summary(uc.lag)
48 | uc.lag1 <- lagsarlm(price.1960 ~ 1, data=used.cars,
49 | nb2listw(usa48.nb), tol.solve=1.0e-13,
50 | control=list(tol.opt=.Machine$double.eps^0.3))
51 | summary(uc.lag1)
52 | uc.err1 <- errorsarlm(price.1960 ~ 1, data=used.cars,
53 | nb2listw(usa48.nb), tol.solve=1.0e-13,
54 | control=list(tol.opt=.Machine$double.eps^0.3),
55 | Durbin=FALSE)
56 | summary(uc.err1)
57 | }
58 | }
59 | }
60 | }
61 | \references{
62 | Hepple, L. W. 1976 A maximum likelihood model for econometric estimation with spatial series, in Masser, I (ed) Theory and practice in regional science, London: Pion, pp. 90-104.
63 | }
64 | \keyword{datasets}
65 | \keyword{spdep}
66 |
--------------------------------------------------------------------------------
/man/wheat.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/wheat.R
3 | \docType{data}
4 | \name{wheat}
5 | \alias{wheat}
6 | \title{Mercer and Hall wheat yield data}
7 | \format{
8 | The format of the object generated by running \code{data(wheat)} is a three column data frame made available by Hongfei Li. The example section shows how to convert this to the object used in demonstrating the \code{aple} function, and is a formal class 'SpatialPolygonsDataFrame' [package "sp"] with 5 slots; the data slot is a data frame with 500 observations on the following 6 variables.
9 | \itemize{
10 | \item{lat: local coordinates northings ordered north to south}
11 | \item{yield: Mercer and Hall wheat yield data}
12 | \item{r: rows south to north; levels in distance units of plot centres}
13 | \item{c: columns west to east; levels in distance units of plot centres}
14 | \item{lon: local coordinates eastings}
15 | \item{lat1: local coordinates northings ordered south to north}
16 | }
17 | }
18 | \source{
19 | Cressie, N. A. C. (1993) Statistics for Spatial Data. Wiley, New York, p. 455.
20 | }
21 | \usage{
22 | wheat
23 | }
24 | \description{
25 | Mercer and Hall wheat yield data, based on version in Cressie (1993), p. 455.
26 | }
27 | \note{
28 | The value of 4.03 was changed to 4.33 (wheat[71,]) 13 January 2014; thanks to Sandy Burden; cross-checked with http://www.itc.nl/personal/rossiter/teach/R/mhw.csv, which agrees.
29 | }
30 | \examples{
31 | \donttest{
32 | if (requireNamespace("sp", quietly = TRUE)) {
33 | library(sp)
34 | data(wheat)
35 | wheat$lat1 <- 69 - wheat$lat
36 | wheat$r <- factor(wheat$lat1)
37 | wheat$c <- factor(wheat$lon)
38 | wheat_sp <- wheat
39 | coordinates(wheat_sp) <- c("lon", "lat1")
40 | wheat_spg <- wheat_sp
41 |
42 | gridded(wheat_spg) <- TRUE
43 | wheat_spl <- as(wheat_spg, "SpatialPolygons")
44 | df <- as(wheat_spg, "data.frame")
45 | row.names(df) <- sapply(slot(wheat_spl, "polygons"),
46 | function(x) slot(x, "ID"))
47 | wheat <- SpatialPolygonsDataFrame(wheat_spl, data=df)
48 | }
49 | }
50 |
51 | if (requireNamespace("sf", quietly = TRUE)) {
52 | library(sf)
53 | wheat <- st_read(system.file("shapes/wheat.gpkg", package="spData"))
54 | plot(wheat)
55 | }
56 | }
57 | \references{
58 | Mercer, W. B. and Hall, A. D. (1911) The experimental error of field trials. Journal of Agricultural Science 4, 107-132.
59 | }
60 | \keyword{datasets}
61 | \keyword{sf}
62 |
--------------------------------------------------------------------------------
/man/world.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/world.R
3 | \docType{data}
4 | \name{world}
5 | \alias{world}
6 | \alias{wrld}
7 | \title{World country polygons}
8 | \format{
9 | Formal class 'sf' [package "sf"]; the data contains a data.frame with 177 obs. of 11 variables:
10 | \itemize{
11 | \item{iso_a2: character vector of ISO 2 character country codes}
12 | \item{name_long: character vector of country names}
13 | \item{continent: character vector of continent names}
14 | \item{region_un: character vector of region names}
15 | \item{subregion: character vector of subregion names}
16 | \item{type: character vector of type names}
17 | \item{area_km2: integer vector of area values}
18 | \item{pop: integer vector of population in 2014}
19 | \item{lifeExp: integer vector of life expectancy at birth in 2014}
20 | \item{gdpPercap: integer vector of per-capita GDP in 2014}
21 | \item{geom: sfc_MULTIPOLYGON}
22 | }
23 | The object is in geographical coordinates using the WGS84 datum.
24 | }
25 | \source{
26 | \url{https://www.naturalearthdata.com/}
27 |
28 | \url{https://data.worldbank.org/}
29 | }
30 | \usage{
31 | world
32 | }
33 | \description{
34 | The object loaded is a \code{sf} object containing a world map data from Natural Earth with a few variables from World Bank
35 | }
36 | \examples{
37 | if (requireNamespace("sf", quietly = TRUE)) {
38 | library(sf)
39 | data(world)
40 | # or
41 | world <- st_read(system.file("shapes/world.gpkg", package="spData"))
42 |
43 | plot(world)
44 | }
45 | }
46 | \seealso{
47 | See the rnaturalearth package: https://cran.r-project.org/package=rnaturalearth
48 | }
49 | \keyword{datasets}
50 | \keyword{sf}
51 |
--------------------------------------------------------------------------------
/man/worldbank_df.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/worldbank_df.R
3 | \docType{data}
4 | \name{worldbank_df}
5 | \alias{worldbank_df}
6 | \title{World Bank data}
7 | \format{
8 | Formal class 'data.frame'; the data contains a data.frame with 177 obs. of 7 variables:
9 | \itemize{
10 | \item{name: character vector of country names}
11 | \item{iso_a2: character vector of ISO 2 character country codes}
12 | \item{HDI: human development index (HDI)}
13 | \item{urban_pop: urban population}
14 | \item{unemployment: unemployment, total (\% of total labor force)}
15 | \item{pop_growth: population growth (annual \%)}
16 | \item{literacy: adult literacy rate, population 15+ years, both sexes (\%)}
17 | }
18 | }
19 | \source{
20 | \url{https://data.worldbank.org/}
21 | }
22 | \usage{
23 | worldbank_df
24 | }
25 | \description{
26 | The object loaded is a \code{data.frame} object containing data from World Bank
27 | }
28 | \examples{
29 | data(worldbank_df)
30 | # or
31 | worldbank_df <- read.csv(system.file("misc/worldbank_df.csv", package="spData"))
32 |
33 | summary(worldbank_df)
34 |
35 | }
36 | \seealso{
37 | See the wbstats package: https://cran.r-project.org/web/packages/wbstats
38 | }
39 | \keyword{datasets}
40 |
--------------------------------------------------------------------------------
/spData.Rproj:
--------------------------------------------------------------------------------
1 | Version: 1.0
2 |
3 | RestoreWorkspace: Default
4 | SaveWorkspace: Default
5 | AlwaysSaveHistory: Default
6 |
7 | EnableCodeIndexing: Yes
8 | UseSpacesForTab: Yes
9 | NumSpacesForTab: 8
10 | Encoding: UTF-8
11 |
12 | RnwWeave: knitr
13 | LaTeX: pdfLaTeX
14 |
15 | BuildType: Package
16 | PackageUseDevtools: Yes
17 | PackageInstallArgs: --no-multiarch --with-keep.source
18 | PackageCheckArgs: --as-cran
19 | PackageRoxygenize: rd,collate,namespace,vignette
20 |
--------------------------------------------------------------------------------