#> 1 1.52e12 4.99 2024 2.24e12 3
```
``` r
# 5. Create visualization
gdp_plot <- ggplot(recent_gdp, aes(x = year, y = gdp)) +
geom_line(color = "#0000ff", size = 1.2) +
geom_point(color = "#0000ff", size = 2) +
geom_point(data = filter(recent_gdp, is_recession),
color = "red", size = 3, alpha = 0.7) +
labs(
title = "Czech GDP Trend",
subtitle = "Annual data from Czech National Bank ARAD. Red points indicate recession years.",
x = "Year",
y = "GDP Value",
caption = "Source: Czech National Bank ARAD API via cnbrrr package"
) +
theme_minimal() +
theme(
plot.title = element_text(size = 14, face = "bold", color = "#001F3F"),
plot.subtitle = element_text(size = 12, color = "gray60"),
text = element_text(color = "#001F3F")
)
print(gdp_plot)
```
``` r
# 6. Growth rate visualization
growth_plot <- ggplot(recent_gdp, aes(x = year, y = gdp_growth)) +
geom_col(aes(fill = is_recession), alpha = 0.8) +
geom_hline(yintercept = 0, linetype = "dashed", color = "gray50") +
scale_fill_manual(values = c("FALSE" = "#0000ff", "TRUE" = "red")) +
labs(
title = "Czech GDP Growth Rate",
subtitle = "Year-over-year percentage change",
x = "Year",
y = "GDP Growth (%)",
fill = "Recession",
caption = "Source: Czech National Bank ARAD API via cnbrrr package"
) +
theme_minimal() +
theme(
plot.title = element_text(size = 14, face = "bold", color = "#001F3F"),
plot.subtitle = element_text(size = 12, color = "gray60"),
text = element_text(color = "#001F3F"),
legend.position = "bottom"
)
print(growth_plot)
#> Warning: Removed 1 row containing missing values or values outside the scale range
#> (`geom_col()`).
```
## Data format and structure
All functions return data frames with consistent column structure:
- **`period`**: Date object (converted from YYYYMMDD format)
- **`value`**: Numeric data values
- **`year`**: Extracted year from period
- **`month`**: Extracted month from period
- **`quarter`**: Extracted quarter from period (when applicable)
Additional columns may be present depending on the specific data series.
``` r
# Example of typical data structure
sample_data <- arad_get_data("SRUMD08402C")
#> File already exists at /var/folders/fr/6f85xds52pq7g55fpmk4z7f80000gn/T//RtmpIyo23f/arad_SRUMD08402C.csv. Loading from cache. Use force_redownload = TRUE to redownload.
str(sample_data)
#> tibble [392 × 6] (S3: tbl_df/tbl/data.frame)
#> $ indicator_id: chr [1:392] "SRUMD08402C" "SRUMD08402C" "SRUMD08402C" "SRUMD08402C" ...
#> $ snapshot_id : chr [1:392] NA NA NA NA ...
#> $ period : POSIXct[1:392], format: "2025-08-31" "2025-07-31" ...
#> $ value : num [1:392] 1.50e+12 1.34e+12 1.16e+12 9.45e+11 7.49e+11 ...
#> $ year : num [1:392] 2025 2025 2025 2025 2025 ...
#> $ month : num [1:392] 8 7 6 5 4 3 2 1 12 11 ...
```
## API endpoints used
The package accesses these ARAD API endpoints:
- **`/aradb/api/v1/data`** - Time series data retrieval
- **`/aradb/api/v1/indicators`** - Available indicators listing
- **`/aradb/api/v1/indicators-dims`** - Indicator dimensional structure
- **`/aradb/api/v1/indicators-tree`** - Hierarchical indicator tree structure
## Next steps
- Explore the [function reference](../reference/index.html) for detailed documentation
- Check out additional examples in the [articles](../articles/index.html) section
- Visit the [Czech National Bank ARAD website](https://www.cnb.cz/arad/) for more information about available data series
- Report issues or contribute at the [GitHub repository](https://github.com/petrbouchal/cnbrrr)