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
.
Usage
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
)
Arguments
- tableView
Character. Specifies the view of the table to retrieve. Options include:
"sharkweb_overview"
: Overview table"sharkweb_all"
: All available columns"sharkdata_bacterioplankton"
: Bacterioplankton table"sharkdata_chlorophyll"
: Chlorophyll table"sharkdata_epibenthos"
: Epibenthos table"sharkdata_greyseal"
: Greyseal table"sharkdata_harbourporpoise"
: Harbour porpoise table"sharkdata_harbourseal
: Harbour seal table"sharkdata_jellyfish"
: Jellyfish table"sharkdata_physicalchemical"
: Physical chemical table"sharkdata_physicalchemical_columns"
: Physical chemical table: column view"sharkdata_phytoplankton"
: Phytoplankton table"sharkdata_picoplankton"
: Picoplankton table"sharkdata_planktonbarcoding"
: Plankton barcoding table"sharkdata_primaryproduction"
: Primary production table"sharkdata_ringedseal"
: Ringed seal table"sharkdata_sealpathology"
: Seal pathology table"sharkdata_sedimentation"
: Sedimentation table"sharkdata_zoobenthos"
: Zoobenthos table"sharkdata_zooplankton"
: Zooplankton table"report_sum_year_param"
: Report sum per year and parameter"report_sum_year_param_taxon"
: Report sum per year, parameter and taxon"report_sampling_per_station"
: Report sampling per station"report_obs_taxon"
: Report observed taxa"report_stations"
: Report stations"report_taxon"
: Report taxa
Default is
"sharkweb_overview"
.- limit
Integer. Maximum number of records to retrieve per request. Default is
0
(all records). Maximum 10^5.- headerLang
Character. Language option for column headers. Possible values:
"sv"
: Swedish"en"
: English"short"
: Shortened version"internal_key"
: Internal key (default)
- fromYear
Integer. The starting year for the data to retrieve. Default is
2019
.- toYear
Integer. The ending year for the data to retrieve. Default is
2020
.- months
Integer vector. The months to retrieve data for, e.g.,
c(4, 5, 6)
for April to June.- dataTypes
Character vector. Specifies data types to filter, such as
"Chlorophyll"
or"Epibenthos"
.- parameters
Character vector. Optional vector of parameters to filter results, such as
"Chlorophyll-a"
.- 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).
Value
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.
Details
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
.