Hi David,
GOOD POINT! dput() seems to be very useful. I will use it in my future
post!! THX
dput(mbaye3)
structure(c(0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 1, 0, 0,
0, 1, 3, 1, 0, 0, 4, 0, 0, 0, 3, 0, 0, 0, 0, 1, 6, 0, 0, 0, 2,
0, 0, 0, 0, 1, 8, 0, 0, 0, 0, 0, 0, 1, 0, 2, 13, 3, 0, 0, 2,
1, 2, 3, 0, 1, 7, 2, 0, 0, 3, 2, 5, 1, 0, 1, 13, 0, 0, 0, 1,
1, 5, 6, 3, 1, 6, 1, 0, 0, 2, 1, 1, 6, 3, 1, 20, 4, 0, 0, 4,
1, 2, 3, 4, 0, 15, 0, 0, 0, 1, 0, 2, 2, 9, 1, 9, 2, 0, 0, 0,
2, 3, 5, 6, 3, 5, 1, 0, 0, 0, 2, 6, 3, 6, 2, 16, 4, 0, 4, 4,
0, 3, 3, 5, 0, 5, 1, 1, 3, 2, 1, 3, 1, 5, 3, 8, 3, 0, 2, 0, 0,
1, 4, 1, 2, 5, 1, 1, 5, 3, 0, 2, 2, 1, 0, 5, 3, 0, 3, 0), .Dim = c(10L,
22L), .Dimnames = structure(list(name = c("Denmark", "France",
"Germany", "Greece", "Ireland", "Italy", "Netherlands", "Portugal",
"Spain", "UK"), year = c("1972", "1973", "1974", "1975", "1976",
"1977", "1978", "1979", "1980", "1981", "1982", "1983", "1984",
"1985", "1986", "1987", "1988", "1989", "1990", "1991", "1992",
"1993")), .Names = c("name", "year")), class = c("xtabs", "table"
), call = xtabs(formula = cases ~ name + year, data = mbaye))
Dom
David Winsemius schrieb:
▾ Quoted text (50 lines)
I am not an expert, but I will sometimes take a shot at answering a
question when the construction of an example it not too difficult. In
your case that does not occur. I would need to do multiple cut and
pastes and spend a bunch of time doing unnecessary work. I have zoo and
tseries packages loaded and mbaye3 does not seem to be available. So the
question arises: Why don't more questioners to the R-help list use the
function dput?
Had you give us the output of dput(mbaye3), then testing solutions would
become much more immediate. It would often disclose the answer to class
related puzzles as well. Here's an example:
structure(list(Month = structure(c(2L, 2L, 2L, 2L, 1L, 1L, 1L,
1L, 3L, 3L, 3L, 3L, 3L), .Label = c("Aug", "July", "Sept"), class =
"factor"),
Week = 27:39, Estpassage = c(665L, 2232L, 9241L, 28464L,
41049L, 82216L, 230411L, 358541L, 747839L, 459682L, 609567L,
979475L, 837189L), MedFL = c(34L, 35L, 35L, 35L, 35L, 35L,
35L, 35L, 35L, 36L, 36L, 36L, 36L)), .Names = c("Month",
"Week", "Estpassage", "MedFL"), class = "data.frame", row.names = c(NA,
-13L))
Reversal of the process is trivial.
DF2 <- structure(list(Month = structure(c(2L, 2L, 2L, 2L, 1L, 1L, 1L,
+ 1L, 3L, 3L, 3L, 3L, 3L), .Label = c("Aug", "July", "Sept"), class =
"factor"),
+ Week = 27:39, Estpassage = c(665L, 2232L, 9241L, 28464L,
+ 41049L, 82216L, 230411L, 358541L, 747839L, 459682L, 609567L,
+ 979475L, 837189L), MedFL = c(34L, 35L, 35L, 35L, 35L, 35L,
+ 35L, 35L, 35L, 36L, 36L, 36L, 36L)), .Names = c("Month",
+ "Week", "Estpassage", "MedFL"), class = "data.frame", row.names = c(NA,
+ -13L))
Month Week Estpassage MedFL
1 July 27 665 34
2 July 28 2232 35
3 July 29 9241 35
4 July 30 28464 35
5 Aug 31 41049 35
6 Aug 32 82216 35
7 Aug 33 230411 35
8 Aug 34 358541 35
9 Sept 35 747839 35
10 Sept 36 459682 36
11 Sept 37 609567 36
12 Sept 38 979475 36
13 Sept 39 837189 36