[R] expand time period

dms at riseup.net dms at riseup.net
Mon Nov 19 18:04:13 CET 2012


I'd like to expand the following data to perform a daily time series.
It should cover from '2012-07-01' to '2012-10-06' with the values I
actually have being the mean from one point measurement to another. Does
anyone has a clue to perform this task.


structure(list(Date.beg = structure(c(15635, 15617, 15615, 15610,
15609, 15605, 15604, 15601, 15593, 15593, 15586, 15581, 15580,
15577, 15572, 15565, 15552, 15540, 15530, 15516), class = "Date"),
    Date.end = structure(c(15619, 15619, 15616, 15615, 15610,
    15607, 15604, 15602, 15595, 15594, 15587, 15582, 15581, 15579,
    15572, 15567, 15554, 15541, 15533, 15517), class = "Date"),
    Pollster = structure(c(1L, 2L, 1L, 2L, 1L, 2L, 4L, 1L, 2L,
    1L, 1L, 2L, 1L, 4L, 1L, 2L, 2L, 1L, 3L, 1L), .Label = c("Datafolha",
    "Ibope", "Veritá", "Vox Populi"), class = "factor"), Serra.PSDB = c(24,
    22, 23, 19, 22, 17, 17, 21, 19, 20, 21, 20, 22, 22, 27, 26,
    26, 30, 31.4, 31), Russomanno.PRB = c(23, 22, 25, 27, 30,
    34, 34, 35, 35, 32, 35, 31, 31, 31, 31, 26, 25, 26, 17.7,
    24), Haddad.PT = c(20, 22, 19, 18, 18, 18, 17, 15, 15, 17,
    16, 16, 14, 14, 8, 9, 6, 7, 9.5, 6), Chalita.PMDB = c(11,
    11, 11, 10, 9, 7, 5, 8, 6, 8, 7, 5, 7, 5, 6, 5, 5, 6, 4.3,
    6), Others = c(8, 7, 7, 4, 7, 6, 4, 5, 6, 7, 9, 5, 8, 6,
    10, 12, 15, 15, 8.6, 16), Null = c(8, 8, 8, NA, 8, 10, 10,
    NA, 13, 9, 8, 12, 10, NA, 10, 12, 14, 11, 13.1, 11), Undecided = c(6,
    8, 6, NA, 6, 8, 13, NA, 6, 7, 4, 9, 7, 13, 6, 10, 9, 6, 13.3,
    5), Round = structure(c(3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
    3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 2L), .Label = c("year before",
    "off campaign", "first", "second"), class = "factor"), Stage =
structure(c(2L,
    2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L,
    1L, 1L, 1L, 1L), .Label = c("0", "1", "2"), class = "factor"),
    Serra.Haddad = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = c("",
    "1", "0"), class = "factor"), N = c(3959, 1204, 2099, 1204,
    1799, 1204, 2000, 1802, 1001, 1221, 1078, 1001, 1069, 1200,
    1077, 805, 805, 1075, 1331, 1081), Err = c(2, 3, 2, 3, 2,
    3, 2.2, 2, 3, 3, 3, 3, 3, 2.8, 3, 3, 3, 3, 2.7, 3)), .Names =
c("Date.beg",
"Date.end", "Pollster", "Serra.PSDB", "Russomanno.PRB", "Haddad.PT",
"Chalita.PMDB", "Others", "Null", "Undecided", "Round", "Stage",
"Serra.Haddad", "N", "Err"), row.names = c("6", "7", "8", "9",
"10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20",
"21", "22", "23", "24", "25"), class = "data.frame")



More information about the R-help mailing list