Skip to content
Prev 275739 / 398506 Next

Syntax Check: rshape2 melt()

Rich,

I will be leaving work shortly, and won't be able to look at this again until tomorrow some time.  However, I went back and reread the help page on dcast.  Here is part of that page.

fun.aggregate 

aggregation function needed if variables do not identify a single observation for each output cell. Defaults to length (with a message) if needed but not specified.

It looks like your data may be slightly different than I expected.  The fact that dcast is looking for an aggregation  function suggests that you have more than one record for some combination of site|sampdate|param.  No param value ('TDS', 'SO4', ...) should occur more than once for any combination of site and sampdate (i.e. no multiple measures of the same parameter on the same day in the same site).  So, you might want to check your data to make sure you have no more than 1 measurement per param per sampdate per site.

If that isn't the problem, then I would start thinking about restarting R and then re-installing reshape2.  Good luck.

Dan 

Daniel J. Nordlund
Washington State Department of Social and Health Services
Planning, Performance, and Accountability
Research and Data Analysis Division
Olympia, WA 98504-5204