[R] Adding in Missing Data

Jeff08 jefferyding at gmail.com
Tue Jun 8 09:03:13 CEST 2010


Hey All,

I have just recently thought of a completely different way to accomplish my
analysis (requiring different type of coding)

Instead of going in and filling in data, I could remove any dates not shared
by ALL the id's.

I was thinking about accomplishing this using merge(~~), do you think this
is feasible?

It might take up a bunch of memory at first, going through and subsetting
the data.frame by id.





"Sample Data.Frame format

Name is Returns.names

            X       id ticker      date_ adjClose totret RankStk
427225 427225 00174410    AHS 2001-11-13    21.66    100    1235


"id" uniquely defines a row


What I am trying to do is add missing data for each ID.

Important Information: Date is not continuous, the data points are for
trading days, so weekends/certain holidays are off

x<-unique(Returns.names$date_) gives me the list of all the possible trading
days.

For days that are missing, I would like to add a row for that date & the
same totret as the previous day.

I cant think of an easy way to do this"
-- 
View this message in context: http://r.789695.n4.nabble.com/Adding-in-Missing-Data-tp2246825p2246946.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list