knitr::opts_chunk$set(echo = TRUE,comment='')
The R package qoma.smuggler provides high-level access to the FAME HLI. To open the FAME HLI,
library(ggplot2) library(qoma.smuggler) if(!open_hli())knitr::knit_exit()
To move FAME data across the border to R, provide a database name:
dbname <- paste(Sys.getenv("FAME"),"util","driecon.db",sep="/") cat(dbname)
Read the database into a qoma.smuggler List
:
famedata <- read_fame(dbname)
To display all the contents as a catalog,
print_catalog(famedata,list.len=3)
You may display individual object's meta data from a qoma.smuggler List
.
cat(famedata$get_meta('GDP'))
FAME series are accessible as a tibble
structure with dates expressed as lubridate package structures Date
:
tbl<-famedata$get_data('GDP') str(tbl)
The tibble package is part of the tidyverse ecosystem and works well with packages such as ggplot.
theme_set(theme_minimal()) ggplot(data = tbl, aes(x = date, y = GDP))+ geom_line(color = "#00AFBB", size = 2)
To move R data back across the border to FAME,
mydb <- file.path(tempdir(),"mycopy.db") write_fame(mydb,famedata)
When you complete your work, close the FAME HLI to avoid data loss,
close_hli() file.remove(mydb)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.