Re: [R] Reshape from long to wide format with date variable

2011-07-07 Thread Pete Pete
Thanks, Josh! The index variable (time) was my problem. My R skills are too low! :) Problem solved! -- View this message in context: http://r.789695.n4.nabble.com/Reshape-from-long-to-wide-format-with-date-variable-tp3648833p3650995.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] Reshape from long to wide format with date variable

2011-07-06 Thread Dennis Murphy
Hi: Here's one way with the reshape package. I converted ref to numeric and date to character string first. Sometimes these little things matter... library(plyr) library(reshape) # Modified original data; note the option in the data.frame() statement id=c("034","034","016","016","016","340","340

Re: [R] Reshape from long to wide format with date variable

2011-07-06 Thread Joshua Wiley
Hi Pete, Try the reshape function (see ?reshape for documentation). It can be a bit confusing, but its worth learning if you deal with multiple observations per unit much. Code inline does what you want (though you might need a bit of tweaking to get pretty names, etc. HTH, Josh On Wed, Jul 6

[R] Reshape from long to wide format with date variable

2011-07-06 Thread Pete Pete
Hi, I need to reshape my dataframe from a long format to a wide format. Unfortunately, I have a continuous date variable which gives me headaches. Consider the following example: > id=c("034","034","016","016","016","340","340") > date=as.Date(c("1997-09-28", "1997-10-06", "1997-11-04", "2000-09-