Não foi possível enviar o arquivo. Será algum problema com as permissões?
Aula semana 3

## Aula semana 3

### Comandos do R digitados na aula em 14/03/2007

## introdução a gráficos no R
x <- c(12, 14, 18, 18, 20, 21, 23, 24, 27, 32)
y <- c(54, 62, 60, 67, 71, 71, 78, 81, 87, 89)
plot(x,y)
plot(x,y, type="l")
plot(x,y, type="b")
plot(x,y, type="b")
plot(x,y, type="p")
plot(x,y, type="h")
par(mfrow=c(1,2))
plot(x,y, type="s")
plot(x,y, type="S")
par(mfrow=c(1,1))
plot(x,y, type="l", lty=1)
plot(x,y, type="l", lty=2)
plot(x,y, type="l", lty=3)
plot(x,y, type="n")

plot(x,y, type="p")
plot(x,y, type="p", ylim=c(40, 100))
plot(x,y, type="p", ylim=c(40, 100), main="Diagrama de Dispersão")
plot(x,y, type="p", ylim=c(40, 100), main="Diagrama de Dispersão", xlab="comprimento" , ylab="peso")
plot(x,y, type="p", ylim=c(40, 100), main="Diagrama de Dispersão", xlab=expression(lambda) , ylab=expression(psi))
plot(x,y, col="red")
plot(x,y, col=c("red","black"))
colours()
plot(x,y, col=c(2,1))
plot(1:20, 1:20, col=1:20)
plot(x,y, pch=c("M","F"))
plot(x,y, pch=1:2)
plot(1:25, 1:25, pch=1:25)
plot(x,y, pch=11)
plot(x,y, pch=11, col=c(2,4))

plot(x,y, type="n")
points(x[c(1,3,6,10)], y[c(1,3,6,10)])

plot(x,y, type="n")
ind <- c(1,3,6,10)
points(x[ind], y[ind], pch=19, col=2)
points(x[-ind], y[-ind], pch=19, col=4)

s <- c("M","M","F","F","F","M","F","M","M","F")
plot(x,y, type="n")
points(x[s == "M"], y[s == "M"], pch=19, col=4)
points(x[s == "F"], y[s == "F"], pch=19, col=2)

s == "M"
sum(s == "M")
mean(s == "M")

plot(x,y, pch=19, col=ifelse(s=="M", 4,2))
plot(x,y, pch=s)

## criação de vetores com lei de formação
1:20
-2:3
23:10
seq(1, 20, by=1)
seq(1, 20, by=2)
seq(1, 20, by=0.2)

seq(1, 20, length=20)
seq(1, 20, length=6)
seq(1, 20, length=9)
args(seq)
args(seq.default)
help(seq)

rep(1:3, 4)
rep(1:3, each=4)

rep(seq(1,20, len=4), 3)
rep(1:3, 4:6)
rep(1:4, rep(c(2,4),2))

## gráfico de funções
x <- (-100:100)/10
fx <- x^2 - 3*x -5
plot(x,fx, ty="l")

f2x <- x^2 - 3*x + 1
lines(x, f2x, ty="l", lty=2)

• Recursos