knitr::opts_chunk$set(echo = FALSE)
knitr::read_chunk("../../R/tool.R")
knitr::read_chunk("../../R/data.R")
knitr::read_chunk("../../R/ccze_init_table.R")
<<init>>
<<tool>>
<<data>>
setHeader(title=c("Activité : indicateur de confiance des ménages","Activity: household confidence indicator"),
                    legend=c("solde des opinions","balance of opinions"))
#get data & metadata
data.collection <- getDataCollection()
data.0 <- getData(data.collection,params$data.collection[1])
meta <- data.0[[1]] #metadata
data.0 <- data.0[[2]] #data

#select series
series <- c(1, #variable
            13, #France
            8, #Germany
            23, #Austria
            4, #Belgium
            16, #Cyprus
            12, #Spain
            9, #Estonia
            29, #Finland
            11, #Greece
            10, #Ireland
            15, #Italy
            17, #Latvia
            18, #Lithuania
            19, #Luxembourg,
            21, #Malta
            22, #Netherlands
            25, #Portugal
            28, #Slovakia
            27, #Slovenia
            3, #Euro area
            5, #Bulgaria
            14, #Croatia
            7, #Denmark
            20, #Hungary
            24, #Poland
            26, #Romania
            31, #United Kingdom
            30, #Sweden
            6, #Czech Republic
            2) #European union

data <- t(data.0[,series])

#set metadata:
met <- tail(meta[series],-1)
met <- getCountryByCode(met)

#generate datatable:

#header:

cols <- zoo::as.yearmon(as.character(data[1,]),"%Y-%m")

sketch = htmltools::withTags(table(
  thead(
    tr(
      th(colspan=1,rowspan=2),
      getTH(base::table(as.character(format(cols,"%Y"))),"Y")
    ),
    tr(
      getTH(as.character(format(cols,"%b")),"M")
    )
  )
))

#end header

#data
data <- as.data.frame(data,stringsAsFactors=F)[-1,]
t1 <- genDataTable(data,met,sketch,
                   countries.highlight=c("FR","EA","EU"),nbdigits=2)

#ouput the table
t1
#generate footer:

footer <- htmltools::withTags(
  list(
  )
)

footer <- setFooter(footer,source=c("Commission européenne","European Commission"))

#output footer:
footer


lcamus/pubstat documentation built on May 27, 2019, 1:45 p.m.