Re: [R] reshape: melt and cast

2015-09-01 Thread Matthew Pickard
Yep, that works. Thanks, Stephen. I should have drawn the parallel with Excel Pivot tables sooner. On Tue, Sep 1, 2015 at 9:36 AM, stephen sefick wrote: > I would make this minimal. In other words, use an example data set, dput, > and use output of dput in a block of reproducible code. I don't u

Re: [R] reshape: melt and cast

2015-09-01 Thread Matt Pickard
Thanks, Stephen. I've looked into the fun.aggregate argument. I don't want to aggregate, so I thought leaving it blank (allowing it to default to NULL) would do that. Here's a corrected post (with further explanation): Hi, I have data that looks like this: >dput(head(ratings)) structure(list(Q

Re: [R] reshape: melt and cast

2015-09-01 Thread stephen sefick
You are welcome. On Tue, Sep 1, 2015 at 10:44 AM, Matthew Pickard < matthew.david.pick...@gmail.com> wrote: > Yep, that works. Thanks, Stephen. I should have drawn the parallel with > Excel Pivot tables sooner. > > On Tue, Sep 1, 2015 at 9:36 AM, stephen sefick wrote: > >> I would make this mini

Re: [R] reshape: melt and cast

2015-09-01 Thread stephen sefick
I would make this minimal. In other words, use an example data set, dput, and use output of dput in a block of reproducible code. I don't understand exactly what you want, but does sum work? If there is more than one record for a given set of factors the sum is the sum of the counts. If only one re

Re: [R] reshape: melt and cast

2015-08-31 Thread stephen sefick
This is very hard to read. Please use dput to provide data. I believe the answer is in the manual. Look at the aggregation function argument. Please excuse my brevity; this message was sent from my telephone. On Sep 1, 2015 12:11 AM, "Matt Pickard" wrote: > Hi, > > I have data that looks like th

[R] reshape: melt and cast

2015-08-31 Thread Matt Pickard
Hi, I have data that looks like this: *> head(ratings) QCode PID RaterName SI1 SI2 SI3 SI4 SI5 SI6 SI7 SI8 SI9 SI10 SI111 GUILT 1123 cwormhoudt 2 2 3 1 1 1 3 3 3 212 LOVE 1123 cwormhoudt 1 2 3 2 1 1 1 1 11 33 GUILT 1136 cwormhoudt 1 2

Re: [R] Reshape, melt and cast query

2011-03-10 Thread John Kane
I think we need a sample of the orginal data or reasonable facsimile to get an idea of what you are doing. Have a look at ?dput as a way to provide the data in a handy format. --- On Thu, 3/10/11, Muzna Alvi wrote: > From: Muzna Alvi > Subject: [R] Reshape, melt and cast query > To:

Re: [R] Reshape, melt and cast query

2011-03-10 Thread Muzna Alvi
yes..thats what i was also confused about..but thats what my column is named.. didnt know any other way of doing it. On Thu, Mar 10, 2011 at 9:23 PM, jdnew...@gmail.com < jdnew...@dcn.davis.ca.us> wrote: > I can't see the value of your first melt, which appears to result in a > column filled with

Re: [R] Reshape, melt and cast query

2011-03-10 Thread jdnew...@gmail.com
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 Andro

Re: [R] Reshape, melt and cast query

2011-03-10 Thread Muzna Alvi
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 n

Re: [R] Reshape, melt and cast query

2011-03-10 Thread Ista Zahn
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 wrote: > I have a dataset that is based on crop output for

[R] Reshape, melt and cast query

2011-03-10 Thread Muzna Alvi
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