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 the similar problem as I have.
Copied from Nabble;
------------
But you left it on Nabble which does not forward its updates to the list nor is an archival repository...it deletes things after an interval of a 12-18 months. so here is what you should have included in this last posting:

Dear All,

I am trying to analysis six years traffic data with one timestamp column and one error flag column. I imported data through a postgre ODBC server.
qry<- paste("SELECT timestamp, error ORDER BY timestamp")
data<- sqlQuery(channel,qry)

The data is like so
              timestamp     error
2005-05-01 00:01:06    0
2005-05-01 00:02:46    2
2005-05-01 00:04:52    9
            .                    .
            .                    .
            .                    .

For the record, I formated timestamp in "day of year" and "hour"
            data$hour<- format(data$timestamp,'%H')
            data$doy<- format(data$timestamp,'%j')

For each year, I want to make a matrix in (day of the year) * (hour) which will be like so
         0  1  2   . . . 23
1
2
.
.
365

However random day's record is missing(e.g. there are 40 missing records in 2005 data set), when I tried to use tapply function, matrix came out is 326*23 table and there were no N/A remind me which day is missing data.

Can you give some hints please? Any help is appreciated.


Thank you,
Jessica



--
View this message in context: 
http://r.789695.n4.nabble.com/How-to-make-matrix-missing-data-0-tp3652352p3652432.html
Sent from the R help mailing list archive at Nabble.com.

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

David Winsemius, MD
West Hartford, CT

______________________________________________
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