Skip to content
Prev 168407 / 398502 Next

Data Frame Manipulation: Time Series

Is the what you are after:
+     rep("Chad", 13)), "year"=c(1975:1983, 1989:1995, 1965:1977)),
+     "war"=c(rep(1,2), rep(0,5), rep(1,2), rep(1,2), rep(0,2), rep(1,3),
+         rep(1,4), rep(0,6), rep(1,3)))
+     # create where the war starts
+     .start <- diff(c(0, .cty$war))
+     .cty[(.start == 1) & (.cty$war == 1),]
+ }))
           country year war
Angola.1    Angola 1975   1
Angola.8    Angola 1982   1
Burundi.10 Burundi 1989   1
Burundi.14 Burundi 1993   1
Chad.17       Chad 1965   1
Chad.27       Chad 1975   1
On Tue, Jan 27, 2009 at 5:45 PM, Josip Dasovic <jjd9 at sfu.ca> wrote: