Re: [R] How to make matrix missing data 0

2011-07-07 Thread David Winsemius
On Jul 7, 2011, at 3:52 PM, xin123620 wrote: Thank you William Your method does work I highly appreciate that. :D Also thank you for replying, David. You are absolutely correct. I re-edited my posting to make question clear according to the guidelines in case other person meet

Re: [R] How to make matrix missing data 0

2011-07-07 Thread xin123620
Thank you William Your method does work I highly appreciate that. :D Also thank you for replying, David. You are absolutely correct. I re-edited my posting to make question clear according to the guidelines in case other person meet the similar problem as I have. Thank you, Jessica

Re: [R] How to make matrix missing data 0

2011-07-07 Thread William Dunlap
Make factors out of the dayOfYear and HourOfDay columns and specify the levels you want. Then pass the factors to tapply. E.g., you may have something like > d <- data.frame(Season=c(1,1,3,4), Type=c(20,15,15,20), Speed=11:14) > tapply(d$Speed, d[c("Season","Ty

Re: [R] How to make matrix missing data 0

2011-07-07 Thread David Winsemius
On Jul 7, 2011, at 3:21 PM, xin123620 wrote: Dear All, I am trying to analysis traffic data with one timestamp column and speed column. This data set contains six years data; for each year, I want to make a matrix in (day of the year) * (hour) 0 1 2 . . . 23 1 2 . . 365 Howev