[R] reshape2 issue continued

Ista Zahn istazahn at gmail.com
Wed Jun 5 19:29:43 CEST 2013


There is indeed a ?cast help topic in reshape2, but there is no cast
function. Instead there is dcast (returns a data.frame) and
acast(returns an array).

Bruce, you can try your original example with

input.cast <- dcast(input.melt, Species ~ Date, fun.aggregate = sum)

Best,
Ista

On Wed, Jun 5, 2013 at 11:55 AM, Thomas Adams <tea3rd at gmail.com> wrote:
> Bruce,
>
> I'm not sure what's going on since I tried this on my Linux system running
> R 3.0.0 and just did:
>
> library(reshape2)
> help(cast)
>
> and the help for 'cast' came up. There was no indication to me that
> 'reshape' was needed and I can not see a dependency in CRAN for 'reshape'.
> But I built R from source when installing R 3.0.0 and all the packages I
> use had to be reinstalled...
>
> Great research, BTW!
>
> Tom
>
>
> On Wed, Jun 5, 2013 at 11:42 AM, Neotropical bat risk assessments <
> neotropical.bats at gmail.com> wrote:
>
>> Hi again all,
>> Several replied ASAP that I also needed reshape loaded and not just
>> reshape2.
>> Hmmm tried that and I had some output but not the correct format.
>>
>> What I need is to run simulations of time overlap between species as per
>> the simulation program data input constraints:
>>
>> The basis for the simulations is a species by _time-use matrix in which
>> species are arranged in rows, and time intervals are arranged
>> chronologically in columns.___ TimeOverlap only uses text tab-delimited
>> files with no headings for columns or rows.Empirical data must be
>> specified in proportional abundances (0 to 100) and totals for each
>> species should be the same (100%).
>>
>> With the existing code the result was rows were correct for species but
>> dates were used for columns rather than the times.
>>
>> The input file read has long format 4 columns - species; location; date;
>> time.
>>
>> It dawns on me I may need to have a sub sample of the main data set by
>> Location ID first then have the code run but for time values and not dates.
>>
>> I need to tweak this a bit more to see if I can figure that out as well.
>>
>> I will have many repetitions of this dat reformatting so it is important
>> I get the code correct one time so I can run this on the gazillion or so
>> data sets accumulated.
>>
>> Rather than use reshape can I use _recast_ in place of cast and stick
>> with reshape2?
>>
>> Bruce
>>
>>         [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> 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.
>>
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.



More information about the R-help mailing list