Skip to content

Commit

Permalink
no ribbon if first week only, header update
Browse files Browse the repository at this point in the history
  • Loading branch information
nemeth committed Jan 25, 2021
1 parent 2262a51 commit 57203d8
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions app.R
Original file line number Diff line number Diff line change
Expand Up @@ -444,8 +444,9 @@ tags$p(style="text-align:center;margin-bottom:0px;",
fluidRow(align="center",
HTML('<h2 style="margin-top:0px;margin-bottom:0px;"> Short-term Mortality Fluctuations </h2>'),
HTML('<span>The most recent update is: ', paste(lastupdate), '</span><br/>'),
HTML("<span>The project's website: Human Mortality Database ",as.character(icon("globe", class="contacticon")),"<a href='https://www.mortality.org/'>www.mortality.org</a>", as.character(icon("envelope-o", class="contacticon"))," <a href='mailto:hmd@mortality.org'> hmd@mortality.org</a></span>"),
HTML("<p><span style='color:red;font-weight:bold;'> Data for 2020 is preliminary and for the last 1-3 available weeks may be incomplete.</span>"),
HTML("<span>The project's website: Human Mortality Database ",as.character(icon("globe", class="contacticon")),"<a href='https://www.mortality.org/'>www.mortality.org</a>", as.character(icon("envelope-o", class="contacticon"))," <a href='mailto:hmd@mortality.org'> hmd@mortality.org</a></span><br/>"),
HTML("<span style='color:green;font-weight:bold;'> UX/UI and public GitHub repository ", '<a class=iconlink href="https://github.molgen.mpg.de/nemeth/stmortality">', as.character(icon("github", class="social")), '</a>', " by <a href='https://www.demogr.mpg.de/en/about_us_6113/staff_directory_1899/laszlo_nemeth_2635'> László Németh</a></span><br/>"),
HTML("<span style='color:red;font-weight:bold;'> Data for the last available weeks is preliminary and may be incomplete, please refer to the country-specific metadata for details.", '<a class=iconlink href="https://www.mortality.org/Public/STMF_DOC/STMFmetadata.pdf" style="margin-right:5px;">', as.character(icon("file-pdf-o", class="social")),'</a></span>'),
HTML('<hr style="width=60%;background-color:#66A0C4;height:1px;border-radius:2px;margin: 0px 15px 5px 15px;">')
),

Expand Down Expand Up @@ -1164,6 +1165,9 @@ server=function(input,output,session){
countrychoices= countrylist
dataset$countrychoices = countrychoices
### ribbon
if (length(subdata[Sex=="m"]$Week)==1) {ribbon=subdata} else {


ribbon = rbindlist(by(subdata,subdata$Sex,

function(x){
Expand All @@ -1177,6 +1181,7 @@ server=function(input,output,session){

}
))
}
ribbon$type=ifelse(ribbon$diff>=0,"Excess mortality","Mortality deficit")
ribbon$group=rleid(ribbon$type)

Expand All @@ -1190,6 +1195,7 @@ server=function(input,output,session){

if (input$extracountry == TRUE){
### ribbon
if (length(subdata2[Sex=="m"]$Week)==1) {ribbon2=subdata2} else {
ribbon2 = rbindlist(by(subdata2,subdata2$Sex,

function(x){
Expand All @@ -1203,6 +1209,7 @@ server=function(input,output,session){

}
))
}
ribbon2$type=ifelse(ribbon2$diff>=0,"Excess mortality","Mortality deficit")
ribbon2$group=rleid(ribbon2$type)

Expand Down

0 comments on commit 57203d8

Please sign in to comment.