if (interactive()) {
# initialize connection to Dallas database in Aster
conn = odbcDriverConnect(connection="driver={Aster ODBC Driver};
server=<dbhost>;port=2406;database=<dbname>;uid=<user>;pwd=<pw>")
table_counts = getTableCounts(conn, 'public')
library(reshape2)
library(ggplot2)
library(ggthemes)
data = melt(table_counts, id.vars='TABLE_NAME', measure.vars=c('rowcount','colcount'))
ggplot(data) +
geom_bar(aes(TABLE_NAME, rowcount, fill=TABLE_NAME), stat='identity') +
facet_wrap(~variable, scales = "free_y", ncol=1) +
theme_tufte(ticks=FALSE) +
theme(axis.text.x=element_text(size=12, angle=315, hjust=0),
legend.position="none")
}
Run the code above in your browser using DataLab