[R-es] fechas

jbetancourt jbetancourt en iscmc.cmw.sld.cu
Sab Ene 16 11:49:27 CET 2016


Estimados
Muchas gracias por su ayuda. No he logrado convertir los datos de climas diarios a datos por semana, es decir
 que junto a la identificaci?n de las semanas, quisiera que los datos climaticos de cada semana se reflejaran 
en cada semana .Adjunto datos
Ejemplo
semana48  Max.TemperatureF Mean.TemperatureF Min.TemperatureF etc
Perdonen mis limitados conocimientos

LOS SCRIPT ENVIADOS FUNCIONARON PARA IDENTIFICAR LA SEMANA
#####################################
rm(list = ls()) 
#setwd("D:/Public/Documents/R/r_epidemiolog?a/") 
datIn <- read.table("clima.csv", header=T, as.is=TRUE, sep=",")
datIn
library(lubridate)
#datIn$fecha <- mdy(datIn$CST)
datIn$semana <- week(datIn$fecha)
datIn$semana
##################################################
library("lubridate")
data <- read.csv("clima.csv", stringsAsFactors=F)
# mdy() para formato m/d/y. existe dmy() para formato d/m/y
woy <- week(mdy(data$CST)) #week of year
woy
SEMANAS
1  1  1  1  1  1  1  2  2  2  2  2  2  2  3  3  3  3  3  3  3  4  4  4  4  4  4
 [28]  4  5  5  5  5  5  5  5  6  6  6  6  6  6  6  7  7  7  7  7  7  7  8  8  8  8  8
 [55]  8  8  9  9  9  9  9  9  9 10 10 10 10 10 10 10 11 11 11 11 11 11 11 12 12 12 12
 [82] 12 12 12 13 13 13 13 13 13 13 14 14 14 14 14 14 14 15 15 15 15 15 15 15 16 16 16
[109] 16 16 16 16 17 17 17 17 17 17 17 18 18 18 18 18 18 18 19 19 19 19 19 19 19 20 20
[136] 20 20 20 20 20 21 21 21 21 21 21 21 22 22 22 22 22 22 22 23 23 23 23 23 23 23 24
[163] 24 24 24 24 24 24 25 25 25 25 25 25 25 26 26 26 26 26 26 26 27 27 27 27 27 27 27
[190] 28 28 28 28 28 28 28 29 29 29 29 29 29 29 30 30 30 30 30 30 30 31 31 31 31 31 31
[217] 31 32 32 32 32 32 32 32 33 33 33 33 33 33 33 34 34 34 34 34 34 34 35 35 35 35 35
[244] 35 35 36 36 36 36 36 36 36 37 37 37 37 37 37 37 38 38 38 38 38 38 38 39 39 39 39
[271] 39 39 39 40 40 40 40 40 40 40 41 41 41 41 41 41 41 42 42 42 42 42 42 42 43 43 43
[298] 43 43 43 43 44 44 44 44 44 44 44 45 45 45 45 45 45 45 46 46 46 46 46 46 46 47 47
[325] 47 47 47 47 47 48 48 48 48 48 48 48 49 49 49 49 49 49 49 50 50 50 50 50 50 50 51
[352] 51 51 51 51 51 51 52 52 52 52 52 52 52 53
------------ próxima parte ------------
Se ha borrado un adjunto en formato HTML...
URL: <https://stat.ethz.ch/pipermail/r-help-es/attachments/20160116/03496ab3/attachment-0001.html>
------------ próxima parte ------------
A non-text attachment was scrubbed...
Name: clima.csv
Type: application/octet-stream
Size: 31611 bytes
Desc: no disponible
URL: <https://stat.ethz.ch/pipermail/r-help-es/attachments/20160116/03496ab3/attachment-0001.obj>


Más información sobre la lista de distribución R-help-es