I can't see the value of your first melt, which appears to result in a column filled with identical values "crop_group".
You really should read the posting guide and provide a reproducible example. I suspect that you would benefit from learning how to use the plyr library. -- Sent from my Android phone with K-9 Mail. Please excuse my brevity. Muzna Alvi <muzna.a...@gmail.com> wrote: thanks for that ista actually i want to break this into maybe three different data sets with each of the 3 kinds of sugarcane... it would be better if i could have this in one data set but if someone could tell me how i can run descriplitive statistics on each of the groups separately.. i would need to melt and cast for that right? On Thu, Mar 10, 2011 at 8:46 PM, Ista Zahn <iz...@psych.rochester.edu>wrote: > Hi Muzna, > If I understand your question, it's not really about melting or > casting, but about re-ordering. Try this: > > canefile <- canefile[order(canefile$value), ] > > see ?"[" and ?order > > HTH, > Ista > > On Thu, Mar 10, 2011 at 2:20 PM, Muzna Alvi <muzna.a...@gmail.com> wrote: > > I have a dataset that is based on crop output for a single crop > > *sugarcane*...but > > each observation is further subdivided into 3 kinds of sugarcane > > i have read the file and have also used melt it to sort it on the > > basis of *crop > > group* using > > > > melt(sugarcane, m=c("Crop_group")) -> canefile > > > > this is how it has cast the data > > > > variable value > > 1 Crop_group Sugarcane (first ratoon) > > 2 Crop_group Sugarcane (planted crop) > > 3 Crop_group Sugarcane (planted crop) > > 4 Crop_group Sugarcane (second ratoon) > > 5 Crop_group Sugarcane (first ratoon) > > 6 Crop_group Sugarcane (planted crop) > > > > > > now i need to *cast *the data so that i can have each of the 20 odd > > variables sorted according to the 3 subdivisions under *Crop_group *ie > first > > ratoon), second ratoon etc etc.. > > > > i tried using > > > > cast (canefile, ~value) -> canefile > > > > but it said "Aggregation requires fun.aggregate: length used as default" > > > > i want to cast it on all the 20 variables and sort it on the basis of > first > > ratoon, second ratoon and planted crop > > > > How i do my CAST command? > > > > I hope my question is clear...thanks in advance > > > > * > > * > > * > > * > > -- > > -- > > > > [[alternative HTML version deleted]] > > > >_____________________________________________ > > R-help@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. > > > > > > -- > > > Ista Zahn > Graduate student > University of Rochester > Department of > > Clinical and Social Psychology > http://yourpsyche.org > -- -- > > [[alternative HTML version > > deleted]]_____________________________________________ R-help@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@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.