concept_to_query: Creates query from concept id

Description Usage Arguments Value Examples

View source: R/api.R

Description

Takes either concept (from concepts list - get_concepts function) or takes connection to get the concept by itself and returns a query. A date range can be added.

Usage

1
2
3
4
5
6
7
concept_to_query(
  concept_id,
  connection = NULL,
  concept = NULL,
  start_date = NULL,
  end_date = NULL
)

Arguments

concept_id

concept id of concept to turn into query

connection

connection object (only necessary when concept is NULL)

concept

concept that is turned into query

start_date

start date, if date restriction is wanted

end_date

end date, if date restriction is wanted

Value

query

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# Create and execute simple query

# Step 1. Define concept to use
#         (you can look up all possible ids using get_concepts())
concept_id = "adb_energie.alter"

# Step 2. Create query from concept id and store query in variable
#         Similar to dragging concept in editor field in frontend
query = concept_to_query(concept_id, connection = connection, start_date="2017-01-01", end_date="2017-01-31")

# Step 3. Execute query you created and store query id in variable
query_id = execute_query(connection, query)

# Step 4. Get query result (by default a data.table format is returned)
data = get_query_result(connection, query_id)

ingef/cqapiR documentation built on Dec. 20, 2021, 7:02 p.m.