#chapter 3####
attach(mtcars)
plot(wt,mpg)
abline(lm(mpg~wt)) #adds a line of best fit
title("regression of mpg on weight")
detach(mtcars)
pdf("mygraph.pdf")
attach(mtcars)
plot(wt,mpg)
abline(lm(mpg~wt)) #adds a line of best fit
title("regression of mpg on weight")
detach(mtcars)
dev.off()
#3.2 one simple example###
dose<-c(20,30,40,45,60)
drugA<-c(16,20,27,40,60)
drugB<-c(15,18,25,31,40)
plot(dose,drugA,type = "b")
#3.3graphical parameters###
opar<-par(no.readonly = TRUE)
par(lty=2,pch=17)
plot(dose,drugA,type = "b")
par(opar)
plot(dose,drugA,type = "b",lty=2,pch=17)
#3.3.1
plot(dose,drugA,type = "b",lty=3,lwd=3,pch=20,cex=2,col="lightseagreen")
#3.3.2
colors()
rainbow(10)
sqrt(81)
x<-c(1,2)
underline(x)