[R] reshape2 errors on data frame
ruipbarradas at sapo.pt
Thu Jul 5 21:34:06 CEST 2012
Em 05-07-2012 20:21, Nordlund, Dan (DSHS/RDA) escreveu:
>> -----Original Message-----
>> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
>> project.org] On Behalf Of Rich Shepard
>> Sent: Thursday, July 05, 2012 11:29 AM
>> To: r-help at r-project.org
>> Subject: Re: [R] reshape2 errors on data frame
>> On Thu, 5 Jul 2012, Rich Shepard wrote:
>>> I wonder if the issue is with the logical columns; I've not used
>>> before, only dates, factors, and numerals. I'll try without the
>>> and see if there's a difference.
>> Nope. Same problem as before.
>> Someone, please provide a process I can apply to figure out the
>> error in
>> the data frame.
> I apologize that I did not read your original post carefully enough. I missed that your problem was with the dcast() function. I am not very familiar with the reshape package, but maybe I can give you some ideas of how to proceed. When I ran your melt syntax there was no error message, however there was a messages saying "Using site, sampdate, param as id variables". That is, not all of the ID variables specified were used. So the chem.melt data frame did not have all the ID variables in it. Therefore, when I tried to run the dcast() syntax that you gave, it could not find some of variables specified. In your case, the error message stated that it could not find sampdate. If you run
I should have said that in my earlier post. It's implicit in the
misspeling of the argument 'id.vars', an argument of melt() not of
dcast(). Therefore, melt() issues a warning, the warning in the OP.
I'll reproduce it here:
> chem.melt <- melt(waterchem,
+ idvars = c('site', 'sampdate', 'preeq0', 'param', 'ceneq1', 'floor',
Using site, preeq0, param, ceneq1 as id variables
Hope this helps,
> do you see the variable sampdate? I am not sure how you are wanting to re-shape your data, but when you specify a variable in dcast(), it needs to be in the dataframe you are working with.
> Daniel J. Nordlund
> Washington State Department of Social and Health Services
> Planning, Performance, and Accountability
> Research and Data Analysis Division
> Olympia, WA 98504-5204
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help