Something like this...untested
I think cbind recicles the last value(31) since nov and dec are of different 
length
nov <- kuantan.dt[(kuantan.dt$Bulan >=11);nov
dec <- kuantan.dt[(kuantan.dt$Bulan >=12);dec
both <- cbind(nov,dec)
# get the first 30 records
both <- head(both,30);both


Felipe D. Carrillo
Supervisory Fishery Biologist
Department of the Interior
US Fish & Wildlife Service
California, USA
http://www.fws.gov/redbluff/rbdd_jsmp.aspx


From: Roslina Zakaria <zrosl...@yahoo.com>
>To: "r-help@r-project.org" <r-help@r-project.org> 
>Sent: Sunday, November 11, 2012 6:39 PM
>Subject: [R] arrange data
>
>Dear r-users,
> 
>I have daily rainfall data from 1971 to 2000.  I would like to extract 
>november and december data only.  I would also like to do column bind for 
>november and december, therefore I would like to delete 31 December from 
>december data so that the length of november and december are the same.  Hope 
>somebody can help me.  I tried this below:
> 
>> kuantan.dt.1 <- kuantan.dt[(kuantan.dt$Bulan >=11) & (kuantan.dt$Bulan <= 
>> 12),]
>> head(kuantan.dt.1) ; tail(kuantan.dt.1)
>    Tahun Bulan Hari Jumlah.Hujan.mm.
>305    71    11    1              0.0
>306    71    11    2             16.3
>307    71    11    3              0.0
>308    71    11    4              0.0
>309    71    11    5             12.2
>310    71    11    6              4.6
>      Tahun Bulan Hari Jumlah.Hujan.mm.
>10953     0    12   26              0.0
>10954     0    12   27              0.0
>10955     0    12   28             20.0
>10956     0    12   29             15.5
>10957     0    12   30              6.4
>10958     0    12   31              9.3
>    [[alternative HTML version deleted]]
>
>
>______________________________________________
>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.
>
>
>
        [[alternative HTML version deleted]]

______________________________________________
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.

Reply via email to