> -----Mensaje original----- > De: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] En nombre de zow...@ncst.go.ke > Enviado el: miércoles, 21 de abril de 2010 5:16 > Para: r-help@r-project.org > Asunto: [R] Converting daily data series to monthly series > > Hi Users, > I have daily series of data from 1962 - 2000, with the data > for February 29th in leap years excluded, leaving 365 daily > values for each year. I wish to convert the daily series to > monthly series. How can I do this using the zoo package or > any other package? > > Thanks > > ZABLONE OWITI > GRADUATE STUDENT > Nanjing University of Information, Science and Technology > College of International Education
Let df be your dataframe, #In case you have to format your data as date before setting the montth df$date <- as.Date(df$date, "%d/%m/%Y") #Getting year, month and week from your correctly formatted date df$Year <- as.numeric(format(df$date, "%Y")) #Year df$Month <- as.numeric(format(df$date, "%m")) #Month df$Week <- as.numeric(format(df$date, "%W")) +1 #Week ____________________________________________________________________________________ Dr. Rubén Roa-Ureta AZTI - Tecnalia / Marine Research Unit Txatxarramendi Ugartea z/g 48395 Sukarrieta (Bizkaia) SPAIN ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.