ls_objects
Let's create a few objects in R but before we want to load some libraries:
library(miscr) library(data.table) library(magrittr) library(ggplot2)
data(mtcars) data(iris) mtcars <- data.table(mtcars) x <- 1 y <- c(0,1)
The results vary depending on options:
ls_objects() ls_objects(database = F)
datem_conv
Easy to juggle with Ken French type of date format, yyymm and monthly specific date format for panel from statar yyyy'm'mm and vice versa. It is easy to see an example
x <- 198312 y <- datem_conv(x) z <- datem_conv(y) print(y) print(z)
fred_download
: clean dataset from FredTo download data from FRED, use the fredr library and put the data in a decent format.
dt_gdp <- getFred("GDP") dt_gdp
gg_bw
: mostly black & white themep <- dt_gdp %>% ggplot( aes(date, GDP) ) + geom_line() p p + gg_bw()
dualplot
: two time series with different axesdt_gdp <- getFred("GDP") dt_sp <- getFred("SP500") dt_plot <- merge(dt_gdp[, GDP := log(GDP)], dt_sp[, .(SP500 = log(SP500), date_daily = date, date_ym)], by = c("date_ym")) miscr:::dualplot(dt_plot$date_daily, dt_plot$GDP, dt_plot$SP500, x2 = dt_plot$date_daily, ylim1 = c(9, 10), ylim2 = c(6, 8), ylab1 = c("gdp"), ylab2 = c("sp500"))
emailme
: email results to selfemailme(dt_gdp) # email data emailme(p + gg_bw()) # email plot emailme() # email last result
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.