?match
tempmat<-match(months, y=c("January","February","March","April","May","June"), by=month)#
tempmat<-match(months, c("January","February","March","April","May","June"), by=month)#
tempmat<-match(months, c("January","February","March","April","May","June"))
tempmat<-as.matrix(match(months, c("January","February","March","April","May","June")))
View(tempmat)
n<-c(40,42,51,55,58,62)
tempdata<-rnorm(n=months, mean=n, sd=5)
temp<-rbind(x,tempdata)
View(temp)
temperature<-as.data.frame(t(temp))
View(temperature)
temperature<-data.frame(t(x,tempdata))
?data.frame
temperature<-data.frame(as.Date(x),tempdata)
View(temperature)
Meanmonthtemp<-ddply(temperature,.(as.Date.x),summarise,mean_temp=mean(tempdata,na.rm=T))
require(plyr)
Meanmonthtemp<-ddply(temperature,.(as.Date.x),summarise,mean_temp=mean(tempdata,na.rm=T))
View(temperature)
Meanmonthtemp<-ddply(temperature,.(as.Date.x.),summarise,mean_temp=mean(tempdata,na.rm=T))
View(Meanmonthtemp)
temperature$as.Date.x.<-as.Date(temperature$as.Date.x.)
Meanmonthtemp<-ddply(temperature,.(as.Date.x.),summarise,mean_temp=mean(tempdata,na.rm=T))
temperature$month<-months(temperature$as.Date.x.)
Meanmonthtemp<-ddply(temperature,.(month),summarise,mean_temp=mean(tempdata,na.rm=T))
View(Meanmonthtemp)
anyDuplicated(temperature$tempdata)
y<-seq(as.Date("2010-1-1"),as.Date("2010-6-30"), by="1+day")
y<-seq(as.Date("2010-1-1"),as.Date("2010-6-30"), by="1+ day")
y<-seq(as.Date("2010-1-1"),as.Date("2010-6-30"), by=1+"day")
y<-seq(as.Date("2010-1-1"),as.Date("2010-6-30"), by="days +1")
y<-seq(as.Date("2010-1-1"),as.Date("2010-6-30"), by="+1 day")
weather<-c("sunny","cloudy","partly cloudy")
b<-rnorm(c(y),mean=5,sd=3, lower.tail=F)
b<-rnorm(c(y),mean=5,sd=3)
observations<-data.frame(as.Date(y),sample(weather),b)
y<-seq(as.Date("2010-1-1"),as.Date("2010-6-30"), by="2 days")
weather<-c("sunny","cloudy","partly cloudy")
b<-rnorm(c(y),mean=5,sd=3)
observations<-data.frame(as.Date(y),sample(weather),b)
weather<-sample(c("sunny","cloudy","partly cloudy"))
observations<-data.frame(as.Date(y),weather,b)
?sample
observations<-data.frame(as.Date(y),sample(weather,size=91),b)
observations<-data.frame(as.Date(y),sample(weather,size=91, replace=T),b)
View(observations)
observations[observations$b<"0"]<-0
observations[,observations$b<"0"]<-0
observations[observations$b<"0",]<-0
observations[observations$b<="0"]<-0
observations["b"<"0"]<-0
View(observations)
observations["b"=<"0"]<-0
observations["b"<0]<-0
View(observations)
observations[b<0]<-0
observations$b[b<0]<-0
View(observations)
View(observations)
?merge
Weather<-merge(temperature, observations, by.x="as.Date.x.",by.y="as.Date.y.", all=F,incomparables=NULL)
View(Weather)
?plot
plot(mack$Year,mack$spawners.black, type='l',col="black" )
require(scales)
require(plyr)
mack.black<-read.table("http://ram.biology.dal.ca/ftp/pub/sr/MACKBLACK.dat",
sep="",na.strings="NA",dec=".",strip.white=T)
mack.nafo<-read.table("http://ram.biology.dal.ca/ftp/pub/sr/MACK2-6.dat",
sep="",na.strings="NA",dec=".",strip.white=T)
mack.ices<-read.table("http://ram.biology.dal.ca/ftp/pub/sr/MACKWS.dat",
sep="",na.strings="NA",dec=".",strip.white=T)
mack.black<-rename(mack.black, c('V1'='Year',"V2"="spawners",
'V3'='recruits','V4'='catch','V5'='fishMortality'))
mack.nafo<-rename(mack.nafo, c('V1'='Year',"V2"="spawners",
'V3'='recruits','V4'='catch','V5'='fishMortality'))
mack.ices<-rename(mack.ices, c('V1'='Year',"V2"="spawners",
'V3'='recruits','V4'='catch','V5'='fishMortality'))
#q1b
mack.partial<-merge(mack.black, mack.nafo, by="Year",
suffixes=c('.black','.nafo'), incomparables=NA)
#q1c
mack<-merge(mack.partial,mack.ices,by="Year", incomparables=NA)
#1qd
mack<-rename(mack, c('spawners.black'='spawners.black','recruits.black'='recruits.black',
'catch.black'='catch.black','fishMortality.black'='fishMortality.black',
'spawners.nafo'='spawners.nafo','recruits.nafo'='recruits.nafo',
'catch.nafo'='catch.nafo','fishMortality.nafo'='fishMortality.nafo',
'spawners'='spawners.ices','recruits'='recruits.ices',
'catch'='catch.ices','fishMortality=fishMortality.ices'))
mack$fishMortality.ices<-mack$fishMortality
mack$fishMortality<-NULL
mack$Year<-as.Date(mack$Year,"%Y")
mack[mack=="."]<-NA
plot(mack$Year,mack$spawners.black, type='l',col="black" )
plot(mack$Year,mack$spawners.black, type='l',lty=2,col="black" )
?lines
plot(mack$Year,mack$spawners.black, type='l',lty=2,col="black" )
lines(mack$Year,mack$spawners.nafo, type='l',lty=2,col="green")
lines(mack$Year, mack$spawners.ices, type='l',lty=2, col="red")
plot(mack$Year,mack$spawners.nafo, type='l',lty=2,col="green" )
lines(mack$Year,mack$spawners.black, type='l',lty=2,col="black")
lines(mack$Year, mack$spawners.ices, type='l',lty=2, col="red")
plot(mack$Year,mack$spawners.nafo, type='l',lty=2,col="green", ylim=c(0,3500) )
lines(mack$Year,mack$spawners.black, type='l',lty=2,col="black")
lines(mack$Year, mack$spawners.ices, type='l',lty=2, col="red")
View(mack)
?lines
plot(mack$Year,mack$spawners.nafo, type='l',lty=2,col="green", ylim=c(0,3500) )
lines(mack$spawners.black, type='l',lty=2,col="black")
lines(mack$spawners.ices, type='l',lty=2, col="red")
plot(mack$Year,mack$spawners.nafo, type='l',lty=2,col="green", ylim=c(0,3500) )
lines(mack$Year,mack$spawners.black, type='l',lty=2,col="black")
lines(mack$Year,mack$spawners.ices, type='l',lty=2, col="red")
plot(mack$Year,mack$spawners.nafo, type='l',lty=2,col="green", ylim=c(0,3500))
lines(mack$Year,mack$spawners.black, type='l',lty=2,col="black")
lines(mack$Year,mack$spawners.ices, type='l',lty=2, col="red")
plot(mack$Year,mack$spawners.nafo, type='l',lty=2,col="red", ylim=c(0,3500))
lines(mack$Year,mack$spawners.black, type='l',lty=2,col="black")
lines(mack$Year,mack$spawners.ices, type='l',lty=2, col="green")
plot(mack$Year,mack$spawners.nafo, type='l',lty=2,col="red", ylim=c(0,3500))
lines(mack$Year,as.numeric(mack$spawners.black), type='l',lty=2,col="black")
lines(mack$Year,as.numeric(mack$spawners.ices), type='l',lty=2, col="green")
plot(mack$Year,mack$spawners.nafo, type='l',lty=2,col="red", ylim=c(0,3500))
lines(mack$Year,mack$spawners.black, type='l',lty=2,col="black")
lines(mack$Year,mack$spawners.ices, type='l',lty=2, col="green")
plot(mack$Year,mack$spawners.nafo, type='l',lty=2,col="red", ylim=c(0,3500))
lines(mack$Year,mack[spawners.black,], type='l',lty=2,col="black")
lines(mack$Year,mack[spawners.ices,], type='l',lty=2, col="green")
plot(mack$Year,mack$spawners.nafo, type='l',lty=2,col="red", ylim=c(0,3500))
lines(mack$Year,mack["spawners.black",], type='l',lty=2,col="black")
lines(mack$Year,mack"[spawners.ices"], type='l',lty=2, col="green")
plot(mack$Year,mack$spawners.nafo, type='l',lty=2,col="red", ylim=c(0,3500))
lines(mack$Year,mack["spawners.black"], type='l',lty=2,col="black")
lines(mack$Year,mack['spawners.ices"], type='l',lty=2, col="green")
plot(mack$Year,mack$spawners.nafo, type='l',lty=2,col="red", ylim=c(0,3500))
lines(mack$spawners.black, type='l',lty=2,col="black")
lines(mack$spawners.ices, type='l',lty=2, col="green")
plot(mack$Year,mack$spawners.nafo, type='l',lty=2,col="red", ylim=c(0,3500))
lines(mack$Year,mack$spawners.black, type='l',lty=2,col="black")
lines(mack$Year,mack$spawners.ices, type='l',lty=2, col="green")
plot(mack$Year~mack$spawners.nafo, type='l',lty=2,col="red", ylim=c(0,3500))
lines(mack$Year~mack$spawners.black, type='l',lty=2,col="black")
lines(mack$Year~mack$spawners.ices, type='l',lty=2, col="green")
plot(mack$Year,mack$spawners.nafo, type='l',lty=2,col="red", ylim=c(0,3500))
lines(mack$Year,mack$spawners.black, type='l',lty=2,col="black")
lines(mack$Year,mack$spawners.ices, type='l',lty=2, col="green")
mack$spawners.ices
mack$spawners.black<-as.numeric(spawners$black)
mack$spawners.black<-as.numeric(mack$spawners.black)
mack$spawners.ices<-as.numeric(mack$spawners.ices)
plot(mack$Year,mack$spawners.nafo, type='l',lty=2,col="red", ylim=c(0,3500))
lines(mack$Year,mack$spawners.black, type='l',lty=2,col="black")
lines(mack$Year,mack$spawners.ices, type='l',lty=2, col="green")
plot(mack$spawners.nafo, type='l',lty=2,col="red", ylim=c(0,3500))
lines(mack$spawners.black, type='l',lty=2,col="black")
lines(mack$spawners.ices, type='l',lty=2, col="green")
plot(mack$Year,mack$spawners.nafo, type='l',lty=2,col="red", ylim=c(0,3500))
lines(mack$Year,mack$spawners.black, type='l',lty=2,col="black")
lines(mack$Year,mack$spawners.ices, type='l',lty=2, col="green")
title(main="Atlantic Mackeral", xlab="Years",ylab="Spawner Biomass (thousands of tons)")
plot(mack$Year,mack$spawners.nafo, type='l',lty=2,col="red", ylim=c(0,3500),
xlab="Years",ylab="Spawner Biomass (thousands of tons)")
lines(mack$Year,mack$spawners.black, type='l',lty=2,col="black")
lines(mack$Year,mack$spawners.ices, type='l',lty=2, col="green")
title(main="Atlantic Mackeral")
minmeancond<-data.frame(c(mean(Weather$tempdata),min(Weather$tempdata),mean(Weather$b),min(Weather$b)))
View(minmeancond)
minmaxcond<-data.frame(c(min(Weather$tempdata),max(Weather$tempdata),
min(Weather$b),max(Weather$b)))
View(minmaxcond)
minmaxcond<-data.frame(t(c(min(Weather$tempdata),max(Weather$tempdata),
min(Weather$b),max(Weather$b)))
)
View(minmaxcond)
minmaxcond<-rename(minmaxcond,c("X1"="Min Temp","X2"="Max Temp","X3"="Min Wind","X4"="Max Wind"))
Table(sample.weather..size...91..replace...T.)
table(sample.weather..size...91..replace...T.)
table(Weather$sample.weather..size...91..replace...T.)
is.numeric(mack$spawners.ices)
?legend
plot(mack$Year,mack$spawners.nafo, type='l',lty=2,col="red", ylim=c(0,3500),
xlab="Years",ylab="Spawner Biomass (thousands of tons)")
lines(mack$Year,mack$spawners.black, type='l',lty=2,col="black")
lines(mack$Year,mack$spawners.ices, type='l',lty=2, col="green")
title(main="Atlantic Mackeral")
legend(0.9,0.2)
plot(mack$Year,mack$spawners.nafo, type='l',lty=2,col="red", ylim=c(0,3500),
xlab="Years",ylab="Spawner Biomass (thousands of tons)")
lines(mack$Year,mack$spawners.black, type='l',lty=2,col="black")
lines(mack$Year,mack$spawners.ices, type='l',lty=2, col="green")
title(main="Atlantic Mackeral")
legend(0.9,0.2,legend)
#Q2
par(mfrow=c(2,1))
x <- seq(-4,4,0.001)
plot(x=x, y=dnorm(x), type="l", lwd=2, col="blue",yaxs="i",
ylim=c(0,0.45),xlab="Value of x", ylab="Density",  xaxt="n")
lines(x=x[x<(-1.96)], y=dnorm(x[x<(-1.96)]),
type="h", col="#77777777")
axis(at=c(-4,-1.96,0,1.96, 4),lab=c("-4","-x", "0","+x", "4"),side=1)
plot(x=x, y=dnorm(x), type="l", lwd=2, col="blue",yaxs="i",
ylim=c(0,0.45),xlab="Value of x", ylab="Density", xaxt="n")
lines(x=x[x<1.96], y=dnorm(x[x<1.96]),
type="h", col="#77777777")
axis(at=c(-4,-1.96,0,1.96, 4),lab=c("-4","-x", "0","+x", "4"),side=1)
quants <- qnorm(c(0.01,0.025,0.05,0.95,0.975,0.99))
round(quants,2)
pnorm(quants)
pnorm(-2.33)
pnorm(-2.33, lower.tail=F)
pnorm(-2.33) + pnorm(-2.33, lower.tail=F)
dnorm(quants)
rnorm(n=10)
?.Random.seed
?set.seed
.Random.seed[1:4]
rnorm(1)
.Random.seed[1:4]
rnorm(1)
.Random.seed[1:4]
set.seed(100)
rnorm(3)
rnorm(3)
set.seed(100)
rnorm(3)
rnorm(3)
2^31-1
-2^31
rnorm(5)
sample(1:6,size=10,replace=T)
sample(c("H","T"), size=10, replace=T)
cards <- paste(rep(c("A",2:10,"J","Q","K"),4),
c("Club","Diamond","Heart","Spade"))
sort(cards)  #check that this worked!
sample(cards,5)
x <- vector(length=10000)
for (i in 1:10000) {
x[i] <- length(grep("Heart", sample(cards,5)))
}
table(x)
x <- vector(length=10000)
for (i in 1:10000) {
x[i] <- 2==length(grep("A", sample(cards,2)))
}
table(x)
x <- vector(length=100000)
for (i in 1:100000) {
x[i] <- length(grep("A", sample(cards,7)))>=4
}
table(x)
?rnorm
Fbomb<-rnorm(100, mean=80, sd=10)
f<-length(which(Fbomb>100)/length(Fbomb))
table(f)
f<-(count(sd(Fbomb>=2))/length(Fbomb))
?count
??count
require(plyr)
f<-((count(sd(Fbomb)>=2))/length(Fbomb))
View(f)
f<-((sd(Fbomb)>=2)/length(Fbomb))
Fbomb<-rnorm(100, mean=80, sd=10)
f<-((sd(Fbomb)>=2)/length(Fbomb))
Fbomb<-rnorm(100, mean=80, sd=10)
f<-((sd(Fbomb)>=2)/length(Fbomb))
f<-pnorm(Fbomb, sd>=2, lower.tail=T)
count(sd(Fbomb)>=2)
f<-length(which(Fbomb>100))/length(Fbomb)
f
f<-length(which(Fbomb>100 && Fbomb<60))/length(Fbomb)
gib<-pnorm(c(-.24>=0>=.24), mean=0,sd=1, lower.tail=T,log.p=F)
require(TeachingDemos)
gib<-pnorm(c(-.24%>=%0%>=%.24), mean=0,sd=1, lower.tail=T,log.p=F)
gib<-pnorm(c(-.24>=0>=.24), mean=0,sd=1, lower.tail=T,log.p=F)
gib<-pnorm(0.12, mean=0,sd=1, lower.tail=T,log.p=F)
gib
plot(gib)
plot(f)
plot(Fbomb)
plot(x=Fbomb, y=pnorm(Fbomb), type="l", lwd=2, col="blue",yaxs="i",
ylim=c(0,0.45),xlab="Value of x", ylab="Density",  xaxt="n")
plot(x=Fbomb, y=dnorm(Fbomb), type="l", lwd=2, col="blue",yaxs="i",
ylim=c(0,0.45),xlab="Value of x", ylab="Density",  xaxt="n")
gib
gib<-pnorm(0.24, mean=0,sd=1, lower.tail=T,log.p=F)
gib
summary(iris)
fivenum(iris[,3]) #min, lower quart, mean, upper q, max for petal length
sd(iris[,3]) # sd for petal length
apply(iris[,1:4], 2, sd, na.rm=T) # sd for each variable, omit spp.
apply(iris[,1:4], 2, range, na.rm=T) #min and max for each variable, omit spp.
boxplot(iris)
pairs(iris[,1:4])
pairs(iris[,1:4], main = "Edgar Anderson's Iris Data", pch = 19,
col = rep(c("#FF000055", "#00FF0055", "#0000FF55"), c(50,50,50)))
pairs(iris[,1:4], main = "Edgar Anderson's Iris Data", pch = 21,
bg = rep(c("red", "green3", "blue"), table(iris$Species)))
hist(iris$Petal.Length, main="", col="gray", xlab="Petal length (cm)")
table(iris$Species)
table(iris$Petal.Length)
par(mfrow=c(1,3))
hist(iris[iris$Species=="setosa",]$Petal.Length, ylim=c(0,50),
breaks=seq(1,7,0.5), main="setosa", col="gray", xlab="Petal length (cm)")
hist(iris[iris$Species=="versicolor",]$Petal.Length, ylim=c(0,50),
breaks=seq(1,7,0.5), main="versicolor", col="gray", xlab="Petal length (cm)")
hist(iris[iris$Species=="virginica",]$Petal.Length,  ylim=c(0,50),
breaks=seq(1,7,0.5), main="virginica", col="gray", xlab="Petal length (cm)")
par(mfrow=c(1,1))
hist(iris$Petal.Length, main="", col="gray", xlab="Petal length (cm)",
freq=F)
lines(density(iris$Petal.Length), lwd=2, col="red")
lines(density(iris$Petal.Length,adjust=0.4), lwd=2, col="blue")
lines(density(iris$Petal.Length,adjust=2), lwd=2, col="green3")
methodA <- c(79.982, 80.041, 80.018, 80.041, 80.03, 80.029, 80.038, 79.968, 80.049, 80.029, 80.019, 80.002, 80.022)
methodB <- c(80.02, 79.939, 79.98, 79.971, 79.97, 80.029, 79.952, 79.968)
boxplot(methodA, methodB, names = c("A", "B"))
par(mfrow = c(1,2))
qqnorm(methodA)
qqline(methodA)
qqnorm(methodB); qqline(methodB)
t.test(methodA, methodB)
resultsAB <- t.test(methodA, methodB)
names(resultsAB)
resultsAB$p.value
var(methodA)
var(methodB)
var.test(methodA, methodB)
t.test(methodA, methodB, var.equal = TRUE)
wilcox.test(methodA, methodB)
?rnorm
farb<-rnorm(30, mean=0, sd=1)
farg<-rexp(30, rate=1)
farp<-rt(30,df=INF)
farn<-rcauchy(30, location=0,scale=1)
farp<-rt(30,df="INF")
farp<-rt(30,df=Inf)
qqnorm(farb)
qqnorm(farg)
qqnorm(farp)
qqnorm(farn)
qqnorm(farb)
qqline(farb)
qqnorm(farg)
qqline(farg)
qqnorm(farp)
qqline(farp)
qqnorm(farn)
qqline(farn)
?cauchy
??cauchy
randomCauchy<-rcauchy(1000, location=5, scale=1)
min(randomCauchy)
max(randomCauchy)
mean(randomCauchy)
?seq
x<-seq.int(from=0.01, to=0.985, by=0.025)
?density
?beta
?dbeta
betaDensity<-dbeta(x, shape1=5, shape2=2, ncp=0, log=F)
?normalize
??normalize
??renormalize
?dbeta
betaDensityNorm<-betaDensity/(sum(betaDensity))
betaDensityNorm
sum(betaDensity)
sum(betaDensityNorm)
lengths<-seq.int(from=12, to=90, by=2)
length(betaDensityNorm)
length(lengths)
?sample
lengthSample<-sample(lengths, size=1000, replace=T, prob=betaDensityNorm)
??histogram
lengthSampleDF<-as.data.frame(lengthSample)
View(lengthSampleDF)
require(ggplot2)
ggplot(lengthSampleDF,aes(x=lengthSample))+geom_histogram(binwidth=0.5)
ggplot(lengthSampleDF,aes(x=lengthSample))+geom_histogram(binwidth=0.5)+geom_density()+ggtitle("Normalized Randomly Distributedn\Lengths of Walking Dead Viewership")+theme_bw()+labs(x="Average Time Spent Watching",y="Number of Self Identified Viewers")
ggplot(lengthSampleDF,aes(x=lengthSample))+geom_histogram(binwidth=0.5)+geom_density()+ggtitle("Normalized Randomly Distributed\nLengths of Walking Dead Viewership")+theme_bw()+labs(x="Average Time Spent Watching",y="Number of Self Identified Viewers")
ggplot(lengthSampleDF,aes(x=lengthSample))+geom_histogram(binwidth=0.5)+geom_density(alpha=.2, fill="red")+ggtitle("Normalized Randomly Distributed\nLengths of Walking Dead Viewership")+theme_bw()+labs(x="Average Time Spent Watching",y="Number of Self Identified Viewers")
ggplot(lengthSampleDF,aes(x=lengthSample))+geom_histogram(binwidth=1)+
ggtitle("Normalized Randomly Distributed\nLengths of Walking Dead Viewership")+
theme_bw()+labs(x="Average Time Spent Watching",y="Number of Self Identified Viewers")
?var.test
iris
?subset
virginica<-subset(iris, subset=all, select=(iris$species==virginica))
virginica<-subset(iris, subset=c(iris$Sepal.Width, iris$Species), select=(iris$Species==virginica))
virginica<-subset(iris, subset=(iris$Species=="virginica"), select=iris$Sepal.Width)
View(virginica)
virginica<-subset(iris, subset=iris$Species=="virginica", select=iris$Sepal.Width)
View(virginica)
virginica<-subset(iris, subset=Species=="virginica", select=Sepal.Width)
View(virginica)
versicolor<-subset(iris, subset=Species=="versicolor",select=Sepal.Width)
var.test(versicolor,virginica, ratio=1)
var.test(versicolor$Sepal.Width,virginica$Sepal.Width, ratio=1)
?t.test
t.test(versicolor$Sepal.Width,virginica$Sepal.Width,paired=F, var.equal=F)
t.test(versicolor$Sepal.Width,virginica$Sepal.Width,paired=T, var.equal=F)
t.test(versicolor$Sepal.Width,virginica$Sepal.Width,paired=T, var.equal=T)
t.test(versicolor$Sepal.Width,virginica$Sepal.Width,paired=F, var.equal=T)
?nortest
??nortest
?normality
??normality
irist<-t.test(versicolor$Sepal.Width,virginica$Sepal.Width,paired=F, var.equal=T)
shapiro.test(irist)
qqnorm(irist)
irisv<-var.test(versicolor$Sepal.Width,virginica$Sepal.Width, ratio=1)
qqnorm(irisv)
qqnorm(virginica)
qqline(virginica)
qqnorm(versicolor)
qqline(versicolor)
qqnorm(virginica$Sepal.Width)
qqnorm(virginica$Sepal.Width)
qqline(virginica$Sepal.Width)
qqnorm(versicolor$Sepal.Width)
qqline(versicolor$Sepal.Width)
?wilcox.test
wilcox.test(versicolor$Sepal.Width, virginica$Sepal.Width, paired=F, exact=T)
ggplot(iris, aes(x=Sepal.Width))+
geom_histogram(binwidth=1, color=Species, fill=Species)+
facet_wrap(~species,nrow=2)
ggplot(iris, aes(x=Sepal.Width))+
geom_histogram(binwidth=1, color=iris$Species, fill=iris$Species)+
facet_wrap(~species,nrow=2)
ggplot(iris, aes(x=Sepal.Width))+
geom_histogram(binwidth=1, color=iris$Species, fill=iris$Species)+
facet_wrap(~Species,nrow=2)
#q2e
ggplot(iris, aes(x=Sepal.Width))+
geom_histogram(binwidth=1, fill=iris$Species)+
facet_wrap(~Species,nrow=2)
ggplot(iris, aes(x=Sepal.Width))+
geom_histogram(binwidth=1)+
facet_wrap(~Species,nrow=2)
ggplot(iris, aes(x=Sepal.Width))+
geom_histogram(binwidth=1)+
facet_wrap(~Species,nrow=1)
ggplot(iris, aes(x=Sepal.Width))+
geom_histogram(binwidth=1,color=c(1:3))+
facet_wrap(~Species,nrow=1)
ggplot(iris, aes(x=Sepal.Width), color=Species)+
geom_histogram(binwidth=1)+
facet_wrap(~Species,nrow=1)
ggplot(iris, aes(x=Sepal.Width, color=Species, fill=Species)+
geom_histogram(binwidth=1)+
facet_wrap(~Species,nrow=1)
()
)
ggplot(iris, aes(x=Sepal.Width, color=c(1:3), fill=c(1:3))+
geom_histogram(binwidth=1)+
facet_wrap(~Species,nrow=1)
)
ggplot(iris, aes(x=Sepal.Width))+
geom_histogram(binwidth=1, fill=iris$Species)+
facet_wrap(~Species,nrow=1)
ggplot(iris, aes(x=Sepal.Width))+
geom_histogram(binwidth=1)+
scale_colour_identity()+
facet_wrap(~Species)
ggplot(iris, aes(x=Sepal.Width, colour=Species))+
geom_histogram(binwidth=1)+
scale_colour_identity()+
facet_wrap(~Species)
ggplot(iris, aes(x=Sepal.Width, colour=Species))+
geom_histogram(binwidth=1)+
scale_colour_identity(c(1:3))+
facet_wrap(~Species)
scale_colour_identity(col=c(1:3))+
)
ggplot(iris, aes(x=Sepal.Width, colour=Species))+
geom_histogram(binwidth=1)+
scale_colour_identity(col=c(1:3))+
facet_wrap(~Species)
metals <- read.table("metals.txt", header=T)
metals <- read.table("http://lib.stat.cmu.edu/DASL/Datafiles/Pottery.html", header=T)
metals <- read.table("http://lib.stat.cmu.edu/DASL/Datafiles/Pottery.html", header=F)
metals <- read.table("http://lib.stat.cmu.edu/DASL/Datafiles/Pottery.html", header=T)
ggplot()+
geom_histogram(iris, aes(x=Sepal.Width, color=Species),binwidth=1)+
facet_wrap(~Species)+
scale_colour_manual(values=c(1:3))
require(ggplot2)
ggplot()+
geom_histogram(iris, aes(x=Sepal.Width, color=Species),binwidth=1)+
facet_wrap(~Species)+
scale_colour_manual(values=c(1:3))
ggplot(iris, aes(x=Sepal.Width, color=Species))+
geom_histogram(binwidth=1)+
facet_wrap(~Species)+
scale_colour_manual(values=c(1:3))
ggplot(iris, aes(x=Sepal.Width, color=Species, fill=Species))+
geom_histogram(binwidth=1)+
facet_wrap(~Species)+
scale_colour_manual(values=c(1:3))
ggplot(iris, aes(x=Sepal.Width, color=Species, fill=Species))+
geom_histogram(binwidth=1)+
facet_wrap(~Species)+
scale_colour_manual(values=c(1:3))+
scale_fill_manual(values=c(1:3))
ggplot(iris, aes(x=Sepal.Width, color=Species, fill=Species))+
geom_histogram(binwidth=1)+
facet_wrap(~Species)+
scale_colour_manual(values=c(2:4))+
scale_fill_manual(values=c(2:4))
View(iris)
