Dear useRs,
I have a data frame "y"  starting from 1961 to 2010 in the following manner 
(where A,B,C ......, I are station names and the values uder these are 
"discharge" values.)
> dput(y)
structure(c(1961, 1961, 1961, 1961, 1, 1, 1, 1, 1, 2, 3, 4, 1, 2, 3, 4, 5, 6, 
7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 
27, 28, 29, 30, 31, 32, 33, 34, 35, 36), .Dim = c(4L, 12L), .Dimnames = 
list(NULL, c("year", "month", "day", "A", "B", "C", "D", "E", "F", "G", "H", 
"I")))

I want it to be in the following manner "E" where the stations names are in a 
seperate column and all discharge values are in one column.
> dput(E)

structure(list(year = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L), .Label = "1961", class = "factor"),     month = c(1, 1, 1, 
1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2,     2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 
4, 4, 4, 4, 4, 4, 4,     4), day = c(1L, 2L, 3L, 4L, 1L, 2L, 3L, 4L, 1L, 2L, 
3L, 4L,     1L, 2L, 3L, 4L, 1L, 2L, 3L, 4L, 1L, 2L, 3L, 4L, 1L, 2L, 3L,     4L, 
1L, 2L, 3L, 4L, 1L, 2L, 3L, 4L), discharge = structure(c(1L,     12L, 23L, 31L, 
32L, 33L, 34L, 35L, 36L, 2L, 3L, 4L, 5L, 6L,     7L, 8L, 9L, 10L, 11L, 13L, 
14L, 15L, 16L, 17L, 18L, 19L,     20L, 21L, 22L, 24L, 25L, 26L, 27L, 28L, 29L, 
30L), .Label = c("1",     "10", "11", "12", "13", "14", "15", "16", "17", "18", 
"19",     "2", "20", "21", "22", "23", "24", "25", "26", "27", "28",     "29", 
"3", "30", "31", "32", "33", "34", "35", "36", "4",     "5", "6", "7", "8", 
"9"), class = "factor"), station = c("A",    !
  "A", "A", "A", "B", "B", "B", "B", "C", "C", "C", "C", "D",     "D", "D", 
"D", "E", "E", "E", "E", "F", "F", "F", "F", "G",     "G", "G", "G", "H", "H", 
"H", "H", "I", "I", "I", "I")), .Names = c("year", "month", "day", "discharge", 
"station"), row.names = c(NA, 36L), class = "data.frame")

I hope I followed all the instructions given to be by some fellows.
Thankyou very much in advance.
Eliza
                                          
        [[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.

Reply via email to