get_data {finnishgrid}R Documentation

Main logic forming the API call.

Description

Main logic forming the API call. API key can be provided as function parameter or environment variable (in .Renviron as FINGRID_OPENDATA_API_KEY). Function parameter has precedence in case both are provided. For API spec see https://data.fingrid.fi/en/pages/api.

Usage

get_data(
  api_number = NA,
  start_time_utc = NA,
  end_time_utc = NA,
  user_key = NA,
  page_size = 20000
)

Arguments

api_number

Integer related to the Fingrid Open Data API

start_time_utc

Start time in UTC with offset. Character array in ISO8601, YYYY-MM-ddTHH:mm:ssZ

end_time_utc

End time in UTC with offset. Character array in ISO8601, YYYY-MM-ddTHH:mm:ssZ

user_key

Character array holding API-key. Free from https://data.fingrid.fi/en.

page_size

Integer how many observations are in a single page. Defaults to API maximum 20000.

Value

A data frame object that contains wanted open data.

Examples

## Not run: 
library(finnishgrid)
start = "2024-06-01T00:00:00.000Z"
end = "2024-06-03T00:00:00.000Z"
key = "MY_SUPER_SECRET"
df <- get_data(api_number = 124,  # electricity consumption for Finland
               start_time_utc = start,
               end_time_utc = end,
               user_key = key,
               page_size = 20000)
summary(df)

## End(Not run)

[Package finnishgrid version 0.2.0 Index]