View source: R/shark_api_functions.R
get_shark_table | R Documentation |
This function has been deprecated due to inefficiency in handling large datasets.
Users are encouraged to use get_shark_data
for such cases.
However, the get_shark_table
function remains effective for retrieving smaller
datasets (< 10^5 rows) from the SHARK database hosted by SMHI. Its functionality
is similar to the table view available at https://shark.smhi.se/.
For larger requests, switch to get_shark_data
, and to explore available
filter options, see get_shark_options
.
get_shark_table(
tableView = "sharkweb_overview",
limit = 0,
headerLang = "internal_key",
fromYear = 2019,
toYear = 2020,
months = c(),
dataTypes = c(),
parameters = c(),
orderers = c(),
qualityFlags = c(),
deliverers = c(),
projects = c(),
datasets = c(),
minSamplingDepth = "",
maxSamplingDepth = "",
checkStatus = "",
redListedCategory = c(),
taxonName = c(),
stationName = c(),
vattenDistrikt = c(),
seaBasins = c(),
counties = c(),
municipalities = c(),
waterCategories = c(),
typOmraden = c(),
helcomOspar = c(),
seaAreas = c(),
prod = TRUE,
verbose = TRUE
)
tableView |
Character. Specifies the view of the table to retrieve. Options include:
Default is |
limit |
Integer. Maximum number of records to retrieve per request. Default is |
headerLang |
Character. Language option for column headers. Possible values:
|
fromYear |
Integer. The starting year for the data to retrieve. Default is |
toYear |
Integer. The ending year for the data to retrieve. Default is |
months |
Integer vector. The months to retrieve data for, e.g., |
dataTypes |
Character vector. Specifies data types to filter, such as |
parameters |
Character vector. Optional vector of parameters to filter results, such as |
orderers |
Character vector. Optional vector of orderers to filter data by specific individuals or organizations. |
qualityFlags |
Character vector. Optional vector of quality flags to filter data. |
deliverers |
Character vector. Optional vector of deliverers to filter data by data providers. |
projects |
Character vector. Optional vector of projects to filter data by specific research or monitoring projects. |
datasets |
Character vector. Optional vector of datasets to filter data by specific dataset names. |
minSamplingDepth |
Numeric. Optional minimum depth (in meters) for sampling data to filter results. |
maxSamplingDepth |
Numeric. Optional maximum depth (in meters) for sampling data to filter results. |
checkStatus |
Character string. Optional status check to filter results. |
redListedCategory |
Character vector. Optional vector of red-listed taxa for conservation filtering. |
taxonName |
Character vector. Optional vector of taxa names for filtering specific species or taxa. |
stationName |
Character vector. Optional vector of station names to retrieve data from specific stations. |
vattenDistrikt |
Character vector. Optional vector of water district names to filter data by Swedish water districts. |
seaBasins |
Character vector. Optional vector of sea basin names to filter data by different sea areas. |
counties |
Character vector. Optional vector of counties to filter data within specific administrative regions in Sweden. |
municipalities |
Character vector. Optional vector of municipalities to filter data within specific local administrative regions. |
waterCategories |
Character vector. Optional vector of water categories to filter from. |
typOmraden |
Character vector. Optional vector of type areas to filter data by specific areas. |
helcomOspar |
Character vector. Optional vector of HELCOM or OSPAR areas for regional filtering. |
seaAreas |
Character vector. Optional vector of sea area codes for filtering by specific sea areas |
prod |
Logical. Query against PROD or TEST (SMHI internal) server. Default is TRUE (PROD). |
This function constructs a JSON body with specified parameters and sends a POST request
to the SHARK API. The API returns data in JSON format, which is then parsed into a data.frame
.
If rows have differing lengths, rbind.fill
fills missing columns with NA
.
A data.frame
containing the retrieved data, with column names based on the API's headers
.
Columns are filled with NA
when rows have differing lengths.
get_shark_options
## Not run:
# Retrieve chlorophyll data for April to June from 2019 to 2020
shark_data <- get_shark_table(fromYear = 2019, toYear = 2020,
months = c(4, 5, 6), dataTypes = c("Chlorophyll"))
View(shark_data)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.