You have what is called a "wide" table and you want a "tall" table. In
this case the function melt from reshape2 package is suitable. Be
careful specifying properly the variables (columns) you want to use for
the reshape using correct syntax.
?melt {reshape2}
You can also use as already suggested reshape function. Note the syntax
is slightly different.
?reshape
Good luck,
Xochitl C.
<>< <>< <>< <><
Xochitl CORMON
+33 (0)3 21 99 56 84
Doctorante en sciences halieutiques
PhD student in fishery sciences
<>< <>< <>< <><
IFREMER
Centre Manche Mer du Nord
150 quai Gambetta
62200 Boulogne-sur-Mer
<>< <>< <>< <><
Le 26/08/2013 13:55, Erich Neuwirth a écrit :
Have a look at the packages reshape and reshape2
They were written with this type of problems in mind.
On Aug 26, 2013, at 1:04 PM, catalin roibu<catalinro...@gmail.com> wrote:
Dear all!
I have a data frame composed by 13 columns (year, and 12 months). I want to
transform this data base in another like this
year month values
1901 1
1901 2
1901 3
.....
1901 12
1902 1
1902 2
....
1902 12
Is there a possibility to succeed that in R?
Thank you!
best regards!
CR
--
---
Catalin-Constantin ROIBU
Lecturer PhD, Forestry engineer
Forestry Faculty of Suceava
Str. Universitatii no. 13, Suceava, 720229, Romania
office phone +4 0230 52 29 78, ext. 531
mobile phone +4 0745 53 18 01
+4 0766 71 76 58
FAX: +4 0230 52 16 64
silvic.usv.ro
[[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.
______________________________________________
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.
______________________________________________
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.