Title: | Sotkanet Open Data Access and Analysis |
---|---|
Description: | Access statistical information on welfare and health in Finland from the Sotkanet open data portal <https://sotkanet.fi/sotkanet/fi/index>. |
Authors: | Leo Lahti [aut, cre] , Einari Happonen [aut], Joona Lehtomaki [ctb], Juuso Parkkinen [ctb], Vesa Saaristo [ctb], Pyry Kantanen [aut] , Aleksi Lahtinen [aut] |
Maintainer: | Leo Lahti <[email protected]> |
License: | BSD_2_clause + file LICENSE |
Version: | 0.10.1 |
Built: | 2024-11-20 05:06:14 UTC |
Source: | https://github.com/rOpenGov/sotkanet |
The 'sotkanet' R package aims to make retrieval of sotkanet indicator data easy using R. Sotkanet.fi Statistics and Indicator Bank is maintained by The Finnish Institute for Health and Welfare and it contains data on population welfare and health from 1990 onwards.
The main ways to interact with Sotkanet REST API are with the
following functions: GetDataSotkanet
for downloading data
from specific indicator(s), SotkanetIndicators
for
retrieving metadata on all or user specified indicators as a well
defined list and SotkanetIndicatorMetadata
as a
specialized case returning an untruncated ("raw") output as default.
For citing this package, see citation("sotkanet")
For terms of use of Sotkanet data, see THL Sotkanet REST API documentation (in Finnish).
A short and unofficial English summary of the Finnish Terms of use is as follows: The end user of this package should note that
metadata related to regional classifications and indicators is released under a Creative Commons Attribution 4.0 license (CC BY 4.0),
statistical data and indicators produced by THL are likewise released under a CC BY 4.0 license,
statistical data and indicators produced by other parties than THL should be only used in accordance with a separate agreement.
CC BY 4.0 terms state that when using data accessed through the sotkanet API you should always give appropriate credit to Sotkanet as a data source and include a link to sotkanet website: https://sotkanet.fi. In the case of individual indicators, the producer of the indicator should also be attributed separately.
This information is subject to change and the developers of this package cannot guarantee that information stated here is correct. This unofficial English translation related to data terms of use is provided solely as a convenience to the end user. The user of this package should always check the full text of Sotkanet terms of use from the original source (see the link above to Sotkanet REST API documentation).
Package: | sotkanet |
Type: | Package |
Version: | See sessionInfo() or DESCRIPTION file |
Date: | 2013-2024 |
License: | BSD 2-clause License |
LazyLoad: | yes |
Leo Lahti ([email protected]), Einari Happonen, Juuso Parkkinen Joona Lehtomaki, Vesa Saaristo, Pyry Kantanen and Aleksi Lahtinen
See citation("sotkanet")
Useful links:
library(sotkanet)
library(sotkanet)
Retrieve selected data and combine into a single table.
get_sotkanet( indicators = NULL, years = NULL, genders = c("male", "female", "total"), regions = NULL, region.category = NULL, lang = "fi", user.agent = NULL, cache = TRUE, cache_dir = NULL, frictionless = FALSE )
get_sotkanet( indicators = NULL, years = NULL, genders = c("male", "female", "total"), regions = NULL, region.category = NULL, lang = "fi", user.agent = NULL, cache = TRUE, cache_dir = NULL, frictionless = FALSE )
indicators |
Dataset identifier(s) |
years |
vector of years, for example '2015:2018' or 'c(2010, 2012, ...)'. Default value is 'NULL', which gives the data from all the available years. You can give indicators their own year range by giving the years in a list. See examples for demonstration. |
genders |
vector of genders ('male' | 'female' | 'total'). Some datasets do not work with only the gender value 'total' and return an empty data.frame. In these situations it is advised to check out some other alternative. |
regions |
filter by selected regions only (default: all regions). The region filter has to be given in the language used for the language variable. |
region.category |
filter by one or more of the following 15 valid regions categories (default: all categories)
|
lang |
Language of the data variables: indicator.title, region.title and indicator.organization.title. Default is Finnish ("fi"), the other options being English ("en") and Swedish ("sv"). |
user.agent |
"User agent" defined by the user. Default is NULL which will then use the package identifier "rOpenGov/sotkanet" |
cache |
a logical whether to do caching. Defaults is 'TRUE'. |
cache_dir |
a path to cache directory. 'Null' (default) uses and creates "sotkanet" directory in the temporary directory defined by base R [tempdir()] function. The user can set the cache directory to an existing directory with this argument. |
frictionless |
a logical whether to return a datapackage, with metadata inside, instead of a data.frame. |
THL's open data license and limitation of liability
License
The open data provided by National Institute for Health and Welfare is licensed under CC BY 4.0. This license defines how open data can be utilized. The licensing is based on a decision made by the Director General.
Limitation of Liability
National Institute for Health and Welfare shall not be liable for any loss, legal proceedings, claims, proceedings, demands, costs or damages regardless of their cause or form, which can be directly or indirectly connected to open data or use of open data published by National Institute for Health and Welfare.
Returns a data.frame when frictionless is 'FALSE' and a datapackage when frictionless is 'TRUE'.
Maintainer: Leo Lahti [email protected], Pyry Kantanen
See citation("sotkanet")
For more information about dataset structure, see THL webpage at https://yhteistyotilat.fi/wiki08/pages/viewpage.action?pageId=27557907
THL open data license website: https://yhteistyotilat.fi/wiki08/x/AAadAg
## Not run: dat <- get_sotkanet(indicators = 165) dat <- get_sotkanet(indicators = c(4,5), genders = c("male", "female")) dat <- get_sotkanet(indicators = 10012, regions = c("Suomi", "Ruotsi")) dat <- get_sotkanet(indicators = 10012, region.category = c("POHJOISMAAT")) dat <- get_sotkanet(indicators = 6, lang = "en") dat <- get_sotkanet(indicators = 10027, frictionless = TRUE) dat <- get_sotkanet(indicators = c(4,5,6), years = list("4" = 2000:2010, "5" = 2010:2015, "6" = 2015:2020)) ## End(Not run)
## Not run: dat <- get_sotkanet(indicators = 165) dat <- get_sotkanet(indicators = c(4,5), genders = c("male", "female")) dat <- get_sotkanet(indicators = 10012, regions = c("Suomi", "Ruotsi")) dat <- get_sotkanet(indicators = 10012, region.category = c("POHJOISMAAT")) dat <- get_sotkanet(indicators = 6, lang = "en") dat <- get_sotkanet(indicators = 10027, frictionless = TRUE) dat <- get_sotkanet(indicators = c(4,5,6), years = list("4" = 2000:2010, "5" = 2010:2015, "6" = 2015:2020)) ## End(Not run)
Retrieve selected data and combine into a single table. (This is an older version of the function. It is advised to use the new [get_sotkanet()] function instead.)
GetDataSotkanet( indicators = NULL, years = 1991:2015, genders = c("total"), regions = NULL, region.category = NULL, user.agent = NULL )
GetDataSotkanet( indicators = NULL, years = 1991:2015, genders = c("total"), regions = NULL, region.category = NULL, user.agent = NULL )
indicators |
Dataset identifier(s) |
years |
vector of years c(2010, 2012, ... ) |
genders |
vector of genders ('male' | 'female' | 'total') |
regions |
filter by selected regions only (default: all regions) |
region.category |
filter by one or more of the following 15 valid regions categories (default: all categories)
|
user.agent |
"User agent" defined by the user. Default is NULL which will then use the package identifier "rOpenGov/sotkanet" |
THL's open data license and limitation of liability
License
The open data provided by National Institute for Health and Welfare is licensed under CC BY 4.0. This license defines how open data can be utilized. The licensing is based on a decision made by the Director General.
Limitation of Liability
National Institute for Health and Welfare shall not be liable for any loss, legal proceedings, claims, proceedings, demands, costs or damages regardless of their cause or form, which can be directly or indirectly connected to open data or use of open data published by National Institute for Health and Welfare.
data.frame
Maintainer: Leo Lahti [email protected], Pyry Kantanen
See citation("sotkanet")
For more information about dataset structure, see THL webpage at https://yhteistyotilat.fi/wiki08/pages/viewpage.action?pageId=27557907
THL open data license website: https://yhteistyotilat.fi/wiki08/x/AAadAg
## Not run: dat <- GetDataSotkanet(indicators = 165)
## Not run: dat <- GetDataSotkanet(indicators = 165)
Crates a bibliography from selected Sotkanet data file.
sotkanet_cite(id, lang = "fi", format = "Biblatex")
sotkanet_cite(id, lang = "fi", format = "Biblatex")
id |
Indicator id. |
lang |
Language for the citation. Options are English (en), Finnish (fi) and Swedish (sv). |
format |
Default is "Biblatex", alternatives are "bibentry" or "Bibtex". |
a Biblatex, bibentry or Bibtex object.
See citation("sotkanet")
[utils::bibentry()] [RefManageR::toBiblatex()]
## Not run: SotkanetCite(10013, lang = "en", format = "Biblatex") SotkanetCite(10012, lang = "fi", format = "Biblatex") SotkanetCIte(10011, lang = "sv", format = "Biblatex") SotkanetCite(10013, lang = "en", format = "bibentry") SotkanetCite(10013, lang = "en", format = "Bibtex") ## End(Not run)
## Not run: SotkanetCite(10013, lang = "en", format = "Biblatex") SotkanetCite(10012, lang = "fi", format = "Biblatex") SotkanetCIte(10011, lang = "sv", format = "Biblatex") SotkanetCite(10013, lang = "en", format = "bibentry") SotkanetCite(10013, lang = "en", format = "Bibtex") ## End(Not run)
Delete all .rds files from the sotkanet cache directory.
sotkanet_clean_cache(cache_dir = NULL)
sotkanet_clean_cache(cache_dir = NULL)
cache_dir |
A path to the cache directory. If 'NULL' (default) tries to clean default temporary cache directory. |
## Not run: SotkanetCleanCache() ## End(Not run)
## Not run: SotkanetCleanCache() ## End(Not run)
Retrieves sotkanet indicator metadata.
sotkanet_indicator_metadata( id = NULL, type = "raw", user.agent = NULL, cache = TRUE, cache_dir = NULL )
sotkanet_indicator_metadata( id = NULL, type = "raw", user.agent = NULL, cache = TRUE, cache_dir = NULL )
id |
Indicator id |
type |
Parameter passed onto |
user.agent |
"User agent" defined by the user. Default is NULL which will use the default package identifier "rOpenGov/sotkanet" |
cache |
A logical whether to do caching. |
cache_dir |
A path to the cache dir. |
Data is fetched from
https://sotkanet.fi/rest/1.1/indicators/<id>
sotkanet indicator metadata as a list object
Maintainer: Pyry Kantanen
See citation("sotkanet")
## Not run: x <- sotkanet_indicator_metadata(10012) ## End(Not run)
## Not run: x <- sotkanet_indicator_metadata(10012) ## End(Not run)
Retrieve Sotkanet indicator metadata
sotkanet_indicators( id = NULL, type = "table", lang = "fi", user.agent = NULL, cache = TRUE, cache_dir = NULL )
sotkanet_indicators( id = NULL, type = "table", lang = "fi", user.agent = NULL, cache = TRUE, cache_dir = NULL )
id |
Dataset identifier. Default is NULL returning all |
type |
type output format, either 'table' (default) or 'raw'. Default produces a truncated table with strictly defined columns that are useful in other functions. 'Raw' produces the full output which might be useful for exploratory purposes. |
lang |
Language of the output. |
user.agent |
"User agent" defined by the user. Default is NULL which will then use the package identifier "rOpenGov/sotkanet" |
cache |
a logical whether to do caching. |
cache_dir |
a path to the cache dir. |
Data is fetched from https://sotkanet.fi/rest/1.1/indicators.
data.frame (type = "table) or a list (type = "raw")
Leo Lahti [email protected], Pyry Kantanen
See citation("sotkanet")
## Not run: sotkanet.indicators <- sotkanet_indicators(type = "table", lang = "fi") ## End(Not run)
## Not run: sotkanet.indicators <- sotkanet_indicators(type = "table", lang = "fi") ## End(Not run)
A simple interactive function, that helps with downloading Sotkanet data
sotkanet_interactive(code = NULL)
sotkanet_interactive(code = NULL)
code |
A unique identifier for the dataset of interest. |
[get_sotkanet()]
Retrieves sotkanet regions data.
sotkanet_regions( type = "table", lang = "fi", user.agent = NULL, cache = TRUE, cache_dir = NULL )
sotkanet_regions( type = "table", lang = "fi", user.agent = NULL, cache = TRUE, cache_dir = NULL )
type |
type output format, either 'table' (default) or 'raw'. Default produces a truncated table with strictly defined columns that are useful in other functions. 'Raw' produces the full output which might be useful for exploratory purposes. |
lang |
Language of the output. |
user.agent |
"User agent" defined by the user. Default is NULL which will then use the package identifier "rOpenGov/sotkanet" |
cache |
a logical whether to do caching. |
cache_dir |
a path to the cache directory. |
Data is fetched from https://sotkanet.fi/rest/1.1/regions.
data.frame
Maintainer: Leo Lahti [email protected]
See citation("sotkanet")
## Not run: sotkanet.regions <- sotkanet_regions(type = "table", lang = "fi") ## End(Not run)
## Not run: sotkanet.regions <- sotkanet_regions(type = "table", lang = "fi") ## End(Not run)
Retrieves sotkanet indicator metadata. (This is an older version of the function. It is advised to use the new [sotkanet_indicator_metadata()] function instead.)
SotkanetIndicatorMetadata(id = NULL, type = "raw", user.agent = NULL)
SotkanetIndicatorMetadata(id = NULL, type = "raw", user.agent = NULL)
id |
Indicator id |
type |
Parameter passed onto |
user.agent |
"User agent" defined by the user. Default is NULL which will use the default package identifier "rOpenGov/sotkanet" |
Data is fetched from
https://sotkanet.fi/rest/1.1/indicators/<id>
sotkanet indicator metadata as a list object
Maintainer: Pyry Kantanen
See citation("sotkanet")
## Not run: x <- SotkanetIndicatorMetadata(10013) ## End(Not run)
## Not run: x <- SotkanetIndicatorMetadata(10013) ## End(Not run)
Retrieve Sotkanet indicator metadata. (This is an older version of the function. It is advised to use the new [sotkanet_indicators()] function instead.)
SotkanetIndicators(id = NULL, type = "table", user.agent = NULL)
SotkanetIndicators(id = NULL, type = "table", user.agent = NULL)
id |
Dataset identifier. Default is NULL returning all |
type |
type output format, either 'table' (default) or 'raw'. Default produces a truncated table with strictly defined columns that are useful in other functions. 'Raw' produces the full output which might be useful for exploratory purposes. |
user.agent |
"User agent" defined by the user. Default is NULL which will then use the package identifier "rOpenGov/sotkanet" |
Data is fetched from https://sotkanet.fi/rest/1.1/indicators.
data.frame (type = "table) or a list (type = "raw")
Leo Lahti [email protected], Pyry Kantanen
See citation("sotkanet")
## Not run: sotkanet.indicators <- SotkanetIndicators(type = "table") ## End(Not run)
## Not run: sotkanet.indicators <- SotkanetIndicators(type = "table") ## End(Not run)
Retrieves sotkanet regions data. (This is an older version of the function. It is advised to use the new [sotkanet_regions()] function instead.)
SotkanetRegions(type = "table", user.agent = NULL)
SotkanetRegions(type = "table", user.agent = NULL)
type |
type output format, either 'table' (default) or 'raw'. Default produces a truncated table with strictly defined columns that are useful in other functions. 'Raw' produces the full output which might be useful for exploratory purposes. |
user.agent |
"User agent" defined by the user. Default is NULL which will then use the package identifier "rOpenGov/sotkanet" |
Data is fetched from https://sotkanet.fi/rest/1.1/regions.
data.frame
Maintainer: Leo Lahti [email protected]
See citation("sotkanet")
## Not run: sotkanet.regions <- SotkanetRegions(type = "table") ## End(Not run)
## Not run: sotkanet.regions <- SotkanetRegions(type = "table") ## End(Not run)