data(USnewspapers)
plotNewsRevenue <- function(ys=c(2, 4, 6)){
ylim. <- range(USnewspapers[ys], na.rm=TRUE)
xlim. <- range(USnewspapers$Year)
to2013 <- (USnewspapers$Year<2013)
matplot(USnewspapers$Year[to2013],
USnewspapers[to2013, ys], type='l',
log='y', xlim=xlim., ylim=ylim., las=1,
xlab='', ylab='')
matlines(USnewspapers$Year[!to2013], col=4:6,
USnewspapers[!to2013, ys])
lnms <- outer(names(USnewspapers[c(2, 4, 6)]),
c('', '-est'), paste0)
legend('bottom', lnms, col=1:6, lty=1:6,
cex=0.5)
}
plotNewsRevenue()
plotNewsRevenue(c(3, 5, 7))
plot(100*newspapers_p_GDP~Year, USnewspapers, type='l',
las=1, xlab='', ylab='newspapers percent of GDP')
plot(RevenuePerCap_nominal~Year, USnewspapers, type='l',
las=1, xlab='', ylab='Revenue per capita (nominal)')
plot(RevenuePerCap_2012~Year, USnewspapers, type='l',
las=1, xlab='', ylab='Revenue per capita (2012$)')
Run the code above in your browser using DataLab