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("Indicateurs de performances au sein de la Zone euro","Performance indicators within the Euro area"), legend=c("variation en pourcentage","percentage change"))
htmltools::withTags( p(class="titlechart title", HTML(ifelse(params$lang=="FR","Coût total horaire de la main-d'œuvre","Hourly labour cost")), tags$sup("(a)(b)") ) )
#get data & metadata data.collection <- getDataCollection(params$data.directory) data.y.0 <- getData(data.collection,params$data.collection[1])[[2]] data.q.0 <- tail(getData(data.collection,params$data.collection[2])[[2]],13) meta <- getData(data.collection,params$data.collection[1])[[1]] #select series series <- c(1, #variable 2, #France 3, #Germany 4, #Austria 5, #Belgium 6, #Spain 7, #Finland 8, #Greece 9, #Ireland 10, #Italy 11, #Luxembourg 12, #Netherlands 13, #Portugal 14, #Slovenia 15) #Euro area if (all(is.na(tail(data.y.0[,tail(series,length(series)-1)],1)))) { #if last obs is NA then shift one previous end <- nrow(data.y.0)-1 begin <- end-3 data.y <- t(data.y.0[begin:end,series]) rm(begin,end) } else data.y <- t(tail(data.y.0[,series],3)) data.q <- t(data.q.0[,series]) #set metadata: met <- as.character(meta[2,series]) met <- trimws(unlist(lapply(strsplit(met,":"),"[[",1))) met <- countrynameFR2EN(met) c.fi <- getCountryByCode("fi",params$lang) met <- sub(c.fi,paste0(c.fi," <sup><i>(c)</i></sup>"),met,ignore.case=T) rm(c.fi) #generate datatable: #header: col.q <- as.yearqtr(as.character(data.q[1,]),"%Y-%m") sketch = htmltools::withTags(table( thead( tr( th(colspan=1,rowspan=3), th(colspan=3,rowspan=1,ifelse(params$lang=="FR","Moyenne annuelle","Annual average")), th(colspan=13,rowspan=1,ifelse(params$lang=="FR","Glissement annuel","4-quarterly change"), style=sep.style) ), tr( lapply(as.character(data.y[1,]), th, rowspan=2), getTH(base::table(as.character(format(col.q,"%Y"))),"Y",sep.style) ), tr( getTH(as.character(format(col.q,ifelse(params$lang=="FR","T%q","Q%q"))),"Q",sep.style) ) ) )) #end header #data data <- as.data.frame(cbind(data.y,data.q), stringsAsFactors=F)[-1,] t1 <- genDataTable(data,met[-1],sketch,countries.highlight=c("FR","EA"),sep.col=5,sep.style=sep.style) #ouput the table t1
htmltools::p(class="verticalspace") htmltools::p(class="titlechart title", ifelse(params$lang=="FR","Coût salarial horaire","Hourly wage cost"), tags$sup("(b)") )
#select series series <- c(1, #variable 16, #France 17, #Germany 18, #Austria 19, #Belgium 20, #Spain 21, #Finland 22, #Greece 23, #Ireland 24, #Italy 25, #Luxembourg 26, #Netherlands 27, #Portugal 28, #Slovenia 29) #Euro area data.y <- t(data.y.0[,series]) data.q <- t(data.q.0[,series]) #set metadata: #same as for t1 #generate datatable: #header: #same as for t1 #data: data <- as.data.frame(cbind(data.y,data.q), stringsAsFactors=F)[-1,] t2 <- genDataTable(data[,-1],met[-1],sketch,countries.highlight=c("FR","EA"),sep.col=5,sep.style=sep.style) #ouput the table t2
footer <- htmltools::withTags( list( p(style="text-align: left; font-style: italic; line-height: 50%;", ifelse(params$lang=="FR", "Basé sur la méthodologie NACE révision 2", "Based on methodology NACE revision 2")), tags$ol(class="laparent",style="font-style: italic; padding-left: 3px;", tags$li(HTML(ifelse(params$lang=="FR", "En plus des salaires bruts des employés, les coûts totaux de la main-d'œuvre incluent les coûts indirects tels que les cotisations sociales à la charge des employeurs et les impôts liés à l'emploi", "In addition to employees' gross earnings, total labour costs include indirect costs such as employers' social contributions and taxes connected to the employment"))), tags$li(HTML(ifelse(params$lang=="FR", "Ensemble de l'économie excluant l'agriculture, la pêche et le secteur public", "Whole economy excluding agriculture, fishing and government sectors"))), tags$li(HTML(ifelse(params$lang=="FR", "Données brutes","Unadjusted"))) ) ) ) footer <- setFooter(footer,source=rep("Eurostat",2)) #output footer: footer
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.