On Tue, 22-Jan-2013 at 08:30AM -0500, Ista Zahn wrote:
|> Hi,
|>
|> ID is not the value column. Your casting call should be
|>
|> dcast(aa, ... ~ Target, value.var = "Eaten")
Thanks for that illumination. That does exactly what I wanted. I
knew there were many ways of achieving the result, bu
2 10
A.K.
- Original Message -
From: Patrick Connolly
To: R-help
Cc:
Sent: Tuesday, January 22, 2013 4:23 AM
Subject: [R] Simple use of dcast (reshape2 package)
Suppose I have a small dataframe
> aa
Target Eaten ID
50 TPP 0 1
51 TPP 1 2
52 TPP 3 3
53 TPP
Hi,
ID is not the value column. Your casting call should be
dcast(aa, ... ~ Target, value.var = "Eaten")
Best,
Ista
On Tue, Jan 22, 2013 at 4:23 AM, Patrick Connolly
wrote:
> Suppose I have a small dataframe
>
>> aa
> Target Eaten ID
> 50 TPP 0 1
> 51 TPP 1 2
> 52
Hi, Patrick,
I think (with reshape from the stats package)
reshape( aa, idvar = "ID", v.names = "Eaten", timevar = "Target",
direction = "wide")
does the trick (followed by renaming the columns of the resulting data
frame).
Hth -- Gerrit
On Tue, 22 Jan 2013, Patrick Connolly wr
you could try the following:
DF <- read.table(textConnection("
Target Eaten ID
50 TPP 0 1
51 TPP 1 2
52 TPP 3 3
53 TPP 1 4
54 TPP 2 5
50.1GPA 9 1
51.1GPA11 2
52.1GPA 8 3
53.1GPA 8 4
54.1GPA10 5"),
Suppose I have a small dataframe
> aa
Target Eaten ID
50 TPP 0 1
51 TPP 1 2
52 TPP 3 3
53 TPP 1 4
54 TPP 2 5
50.1GPA 9 1
51.1GPA11 2
52.1GPA 8 3
53.1GPA 8 4
54.1GPA10 5
And I want to reshape it int
6 matches
Mail list logo