[R] assigning creating missing rows and values

From: Schatzi <adele_thompson_at_cargill.com>
Date: Thu, 12 May 2011 13:33:17 -0700 (PDT)


I have a dataset where I have missing times (11:00 and 16:00). I would like the outputs to include the missing time so that the final time vector looks like "realt" and has the previous time's value. Ex. If meas at time 15:30 is 0.45, then the meas for time 16:00 will also be 0.45. meas are the measurements and times are the times at which they were taken.

meas<-runif(18)
times<-c("08:30","09:00","09:30","10:00","10:30","11:30","12:00","12:30","13:00","13:30","14:00","14:30","15:00", "15:30" ,"16:30","17:00","17:30","18:00") output<-data.frame(meas,times)
realt<-c("08:30","09:00","09:30","10:00","10:30","11:00","11:30","12:00","12:30","13:00","13:30","14:00","14:30","15:00","15:30","16:00","16:30","17:00","17:30","18:00")



In theory, practice and theory are the same. In practice, they are not - Albert Einstein
--
View this message in context: http://r.789695.n4.nabble.com/assigning-creating-missing-rows-and-values-tp3518633p3518633.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help_at_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.
Received on Thu 12 May 2011 - 20:36:43 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 13 May 2011 - 21:00:06 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive