Session settings »
pkg <- c("lattice", "latticeExtra", "reshape2", "ggplot2", "knitr")
sapply(pkg, library, character.only=TRUE, logical.return=TRUE)
## Loading required package: RColorBrewer
##
## Attaching package: 'ggplot2'
##
## The following object is masked from 'package:latticeExtra':
##
## layer
## lattice latticeExtra reshape2 ggplot2 knitr
## TRUE TRUE TRUE TRUE TRUE
# Chunk options
opts_chunk$set(
results="hide",
cache=FALSE,
tidy=FALSE,
fig.width=6,
fig.height=5,
fig.align="center",
dpi=150,
dev="png",
dev.args=list(png=list(family="Ubuntu Light", type="cairo")))
options(width=80)
# Lattice settings
source('/media/juanchi/DATA/Dropbox/Projeto tese/C1 Patogeno/latt_juan.R', encoding='UTF-8')
Dataset »
head(dat)
datl=melt(dat, id.vars = c("cod", "uf", "iso"))
head(datl)
datl$diam = datl$value - 0.5
datl= with(datl, cbind(datl[,c(1:3,6)], colsplit(variable, pattern = "\\.", names = c('temp', 'rep'))))
head(datl)
datl$temp = gsub("^.", "", datl$temp)
datl=datl[,c(2,3,5,6,4)]
for (i in 1:2) datl[,i] <- as.factor(datl[,i])
for (i in 3:5) datl[,i] <- as.numeric(datl[,i])
str(datl)
head(datl)
Análise exploratória »
panel.se <- function(x, y, col.se=plot.line$col, alpha.se=.25, ...) {
plot.line <- trellis.par.get("plot.line")
xs <- if(is.factor(x)) {
factor(c(levels(x) , rev(levels(x))), levels=levels(x))
} else {
xx <- sort(unique(x))
c(xx, rev(xx))
}
means <- tapply(y,x, mean, na.rm=T)
vars <- tapply(y,x, var, na.rm=T)
Ns <- tapply(!is.na(y),x, sum)
ses <- sqrt(vars/Ns)
panel.polygon(xs, c(means+ses, rev(means-ses)), col=col.se, alpha=alpha.se)
}
# Crescimento micelial por isolado individual
xyplot(diam ~ temp|iso, groups= uf, data= subset(datl, !temp==5), ty=c("a", "p"),
panel = function(x, y, ...) {
panel.se(x,y, col.se="grey")
panel.xyplot(x, y, ...)
panel.linejoin(x, y, horizontal = FALSE,..., col="black", lty=1, lwd=2)
}
,xlab="Temperatura (°C)",
ylab=expression("Diâmetro da colônia"~(cm)), main="",
sub=list(label="Mean values (black line) +/- SD region (grey area)",
cex=0.75, col="grey50"),
scales=list(cex=0.4),
aspect = 1, layout = c(7, 3, 1)
)
qplot(temp, diam, data = subset(datl, !temp==5)) + facet_wrap(~ iso) + geom_smooth()
qplot(temp, diam, data = subset(datl, !temp==5), geom = "smooth") + facet_wrap(uf~ iso)
# Crescimento micelial por região (UF)
xyplot(diam~temp|uf, groups= iso, data= subset(datl, !temp==5), ty=c("a", "p"),
panel = function(x, y, ...) {
panel.se(x,y, col.se="grey")
panel.xyplot(x, y, ...)
panel.linejoin(x, y, horizontal = FALSE,..., col="black", lty=1, lwd=2)
}
,xlab="Temperatura (°C)",
ylab=expression("Diâmetro da colônia"~(cm)), main="",
sub=list(label="Mean values (black line) +/- SD region (grey area)",
cex=0.75, col="grey50"),
aspect = 1, layout = c(3, 2, 1)
)