[R-br] selecionar intervalo de datas

Eder Comunello ecomunel em gmail.com
Sexta Novembro 2 10:52:34 BRST 2012


Exemplo de operação com datas com seleção por subset

############

dados<-data.frame(
data=c("01/01/2004","01/02/2004","01/03/2004","01/04/2004","01/05/2004","01/06/2004"),
tmin=c(17.82966,18.05029,22.47399,28.20188,13.46510,18.82721),
tmax=c(44.23301,21.11526,22.79882,35.31366,35.84991,39.14286)); dados

dados$data2 <- as.Date(dados$data,"%d/%m/%Y"); dados
length(dados$tmax); mean(dados$tmax)

data.cut <- as.Date("01/02/2004","%d/%m/%Y")
novo <- subset(dados,data2>data.cut); novo
length(novo$tmax); mean(novo$tmax)

##############

Até mais,

-- 

================================================
Éder Comunello

Ph.D. Student in Agricultural Systems Engineering (USP/ESALQ)
Piracicaba, SP, Brazil [22 42.7'S, 47 37.8'W]

Researcher at Embrapa Western Region Agriculture
Dourados, MS, Brazil [22 16.5'S, 54 49.0'W]
================================================
UTC-03:00
-------------- Próxima Parte ----------
Um anexo em HTML foi limpo...
URL: <http://listas.inf.ufpr.br/pipermail/r-br/attachments/20121102/b9440212/attachment.html>


Mais detalhes sobre a lista de discussão R-br