library(CarletonStats)
## Warning: package 'CarletonStats' was built under R version 4.2.3
library(devtools)
## Warning: package 'devtools' was built under R version 4.2.3
## Loading required package: usethis
## Warning: package 'usethis' was built under R version 4.2.2
library(epanetReader)
## Warning: package 'epanetReader' was built under R version 4.2.3
library(fmsb)
## Warning: package 'fmsb' was built under R version 4.2.3
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 4.2.3
library(ggthemes)
## Warning: package 'ggthemes' was built under R version 4.2.3
library(latticeExtra)
## Warning: package 'latticeExtra' was built under R version 4.2.3
## Loading required package: lattice
##
## Attaching package: 'latticeExtra'
## The following object is masked from 'package:ggplot2':
##
## layer
library(MASS)
## Warning: package 'MASS' was built under R version 4.2.3
library(PerformanceAnalytics)
## Warning: package 'PerformanceAnalytics' was built under R version 4.2.3
## Loading required package: xts
## Warning: package 'xts' was built under R version 4.2.3
## Loading required package: zoo
## Warning: package 'zoo' was built under R version 4.2.3
##
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
##
## as.Date, as.Date.numeric
##
## ################################### WARNING ###################################
## # We noticed you have dplyr installed. The dplyr lag() function breaks how #
## # base R's lag() function is supposed to work, which breaks lag(my_xts). #
## # #
## # If you call library(dplyr) later in this session, then calls to lag(my_xts) #
## # that you enter or source() into this session won't work correctly. #
## # #
## # All package code is unaffected because it is protected by the R namespace #
## # mechanism. #
## # #
## # Set `options(xts.warn_dplyr_breaks_lag = FALSE)` to suppress this warning. #
## # #
## # You can use stats::lag() to make sure you're not using dplyr::lag(), or you #
## # can add conflictRules('dplyr', exclude = 'lag') to your .Rprofile to stop #
## # dplyr from breaking base R's lag() function. #
## ################################### WARNING ###################################
##
## Attaching package: 'PerformanceAnalytics'
## The following object is masked from 'package:graphics':
##
## legend
library(psych)
## Warning: package 'psych' was built under R version 4.2.3
##
## Attaching package: 'psych'
## The following objects are masked from 'package:ggplot2':
##
## %+%, alpha
library(plyr)
## Warning: package 'plyr' was built under R version 4.2.3
library(prettyR)
##
## Attaching package: 'prettyR'
## The following objects are masked from 'package:psych':
##
## describe, skew
library(plotrix)
##
## Attaching package: 'plotrix'
## The following object is masked from 'package:prettyR':
##
## valid.n
## The following object is masked from 'package:psych':
##
## rescale
library(proto)
## Warning: package 'proto' was built under R version 4.2.3
library(RCurl)
## Warning: package 'RCurl' was built under R version 4.2.3
library(reshape)
## Warning: package 'reshape' was built under R version 4.2.3
##
## Attaching package: 'reshape'
## The following objects are masked from 'package:plyr':
##
## rename, round_any
library(reshape2)
## Warning: package 'reshape2' was built under R version 4.2.3
##
## Attaching package: 'reshape2'
## The following objects are masked from 'package:reshape':
##
## colsplit, melt, recast
x <- 1967:1977
y <- c(0.5,1.8,4.6,5.3,5.3,5.7,5.4,5,5.5,6,5)
pdf(width=10, height=6)
plot(y ~ x, axes=F, xlab="", ylab="", pch=16, type="b")
axis(1, at=x, label=x, tick=F, family="serif")
axis(2, at=seq(1,6,1), label=sprintf("$%s", seq(300,400,20)), tick=F, las=2, family="serif")
abline(h=6,lty=2)
abline(h=5,lty=2)
text(max(x), min(y)*2.5,"Per capita\nbudget expanditures\nin constant dollars", adj=1,
family="serif")
text(max(x), max(y)/1.08, labels="5%", family="serif")
dev.off()
## png
## 2
#Dot-dash plot in ggplot2
ggplot(mtcars, aes(wt, mpg)) + geom_point() + geom_rug() + theme_tufte(ticks=F) +
xlab("Car weight (lb/1000)") + ylab("Miles per gallon of fuel") +
theme(axis.title.x = element_text(vjust=-0.5), axis.title.y = element_text(vjust=1))
