Hello, Amy,
take a look at
?reshape
In your case, I think,
reshape( yourdatafame, varying = c( "value1", "value2", "value3"),
v.name = "amount", times = c( "value1", "value2", "value3"),
timevar = "name", direction = "long")
should work.
Hth -- Gerrit
On Fri, 17 Dec 2010, Amy Milano wrote:
Dear R helpers
I have one data as given below.
date value1 value2 value3
30-Nov-2010 100 40 61
25-Nov-2010 108 31 88
14-Sep-2010 11 180 56
I want the following output
date name amount
30-Nov-2010 value1 100
30-Nov-2010 value2 40
30-Nov-2010 value3 61
25-Nov-2010 value1 108
25-Nov-2010 value2 31
25-Nov-2010 value3 88
14-Sep-2010 value1 11
14-Sep-2010 value2 180
14-Sep-2010 value3 56
...
______________________________________________
[email protected] 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.