File:Suomen koronavirusepidemia paivayksittain talvi 2020 2021 1.svg

Original file(SVG file, nominally 1,254 × 432 pixels, file size: 56 KB)

Captions

Captions

Add a one-line explanation of what this file represents

Summary

edit
Description
Suomi: Suomen koronavirusepidemia 1. heinäkuuta 2020 alkaen.
Date
Source Own work
Author Merikanto

Souce of data:

Source of data is THL, Finland. THL tilannekatsaus koronaviruksesta Data is also gathered from Ilta-Sanomat, Iltalehti and COVID-19 net site.

https://datahub.io/core/covid-19/r/countries-aggregated.csv

Finally data is in https://fi.wikipedia.org/wiki/Suomen_koronaviruspandemian_aikajana


Data:

Pvm Sairaalassa Teholla Uusia kuolleita Uusia tapauksia 2020-10-01 19 4 0 111 2020-10-02 21 4 1 141 2020-10-03 21 4 0 147 2020-10-04 21 4 0 147 2020-10-05 28 8 1 164 2020-10-06 28 8 0 227 2020-10-07 31 5 0 120 2020-10-08 31 5 0 296 2020-10-09 37 5 0 234 2020-10-10 37 5 0 269 2020-10-11 37 5 0 149 2020-10-12 46 10 0 214 2020-10-13 46 10 0 287 2020-10-14 48 8 4 204 2020-10-15 48 8 0 241 2020-10-16 56 6 1 189 2020-10-17 56 6 0 160 2020-10-18 56 6 0 131 2020-10-19 62 7 0 131 2020-10-20 62 7 0 294 2020-10-21 65 7 0 222 2020-10-22 65 7 0 184 2020-10-23 70 11 0 219 2020-10-24 70 11 0 178 2020-10-25 70 11 0 196 2020-10-26 74 10 1 122 2020-10-27 74 10 0 193 2020-10-28 65 10 0 215 2020-10-29 65 10 0 188 2020-10-30 58 10 4 344 2020-10-31 58 10 0 203 2020-11-01 58 10 0 178 2020-11-02 70 13 1 109 2020-11-03 70 13 0 237 2020-11-04 65 15 2 293 2020-11-05 65 15 0 189 2020-11-06 68 13 1 266 2020-11-07 68 13 0 0 2020-11-08 68 13 0 412 2020-11-09 86 13 1 90 2020-11-10 86 13 0 220 2020-11-11 76 14 2 238 2020-11-12 76 14 0 197 2020-11-13 73 15 4 316 2020-11-14 73 15 0 244 2020-11-15 73 15 0 213 2020-11-16 80 13 2 104 2020-11-17 80 13 0 228 2020-11-18 90 12 3 288 2020-11-19 90 12 0 471 2020-11-20 104 10 1 461 2020-11-21 104 10 0 469 2020-11-22 104 10 0 423 2020-11-23 120 15 9 297 2020-11-24 120 15 0 353 2020-11-25 134 21 4 363 2020-11-26 134 21 0 496 2020-11-27 152 19 5 618 2020-11-28 152 19 0 541 2020-11-29 152 19 0 322 2020-11-30 175 18 6 283 2020-12-01 175 18 0 550 2020-12-02 165 21 9 420 2020-12-03 165 21 0 540 2020-12-04 141 21 7 336 2020-12-05 141 21 0 460 2020-12-06 141 21 0 413 2020-12-07 223 30 9 250 2020-12-08 240 28 0 361 2020-12-09 233 27 8 490 2020-12-10 244 25 9 840 2020-12-11 240 26 11 501 2020-12-12 240 26 0 377 2020-12-13 240 26 0 360 2020-12-14 276 28 8 300 2020-12-15 284 35 5 349 2020-12-16 268 34 6 411 2020-12-17 264 27 12 358 2020-12-18 263 30 5 354 2020-12-19 263 30 0 271 2020-12-20 263 30 0 309 2020-12-21 281 33 17 252 2020-12-22 273 28 5 303 2020-12-23 258 26 13 367 2020-12-24 258 26 0 363 2020-12-25 258 26 0 201 2020-12-26 258 26 0 173 2020-12-27 258 26 0 156 2020-12-28 237 29 22 160 2020-12-29 221 30 4 283 2020-12-30 211 30 6 438 2020-12-31 199 27 5 249

"R" code to obtain info


    1. Download Covid-19 data from Finnish Wikipedia
    2. "R" script
    3. New cases, new deaths, ward, icu, active cases ...
      1. plot ward, icu, daily deaths
    4. draft version 0003.0001
  1. 01.01.2021


  1. install.packages("rvest")
  2. install.packages("readtext")
  3. install.packages("stringi")
  4. install.packages("datamart")
  5. install.packages("XML")
  6. install.packages("svglite")
  7. install.packages("ggplot2")
  8. install.packages("tidyr")
  9. install.packages("stringr")
  10. install.packages("stringi")
  11. install.packages("tibble")


library(rvest) library(readtext) library(stringi) library(datamart) library(XML) library(ggplot2) library(tidyr) library(stringr) library(stringi) library(tibble)

    1. NOTE date limits change this
  1. datelimits1=c('1/3/2020', '9/11/2020')
    1. display date limits

beginday1='1/10/2020'

today=Sys.Date() yesterday=today-1

rajapaiva=yesterday

  1. print(today)
  2. print (yesterday)
  1. stop(-1)
  1. today1=format(today, "%d/%m/%Y")
  2. today2=format(today, "%Y/%m/%d")

rajapaiva1=format(rajapaiva, "%d/%m/%Y") rajapaiva2=format(rajapaiva, "%Y/%m/%d")

  1. print(today1)
  2. print(today2)
  1. stop(-1)
  1. datelimits1=c(beginday1, today1)

datelimits1=c(beginday1, rajapaiva1)

    1. dates of dataset

paivat1=seq(as.Date("2020/4/1"), as.Date(rajapaiva2), "days")


plottaa=1 ## must be 1

    1. 1 : ward, icu 2 : ward, active infections
    2. 3 ward, icu, deaths

tulosta_svg=2 # plot to out svg 0, 1 of 2

    1. smooth curves pars
  1. spanni=0.2

spanni=0.2 metodi="loess"

filename1="./koronan_takia_sairaalassa_ja_teholla_1.svg"


url1="https://fi.wikipedia.org/wiki/Suomen_koronaviruspandemian_aikajana" destfile1="./ward0.txt"

download.file(url1, destfile1) texti000<-readtext(destfile1) texti0<-texti000$text

etsittava1="1. huhtikuuta 2020 alkaen" len1=nchar(texti0) k1=regexpr(pattern=etsittava1, texti0) k1b=len1-k1 texti1=strtail(texti0,k1b) sink("out1.txt") print (texti1) sink()

etsittava2=""

k2=regexpr(pattern=etsittava2, texti1) texti2=strhead(texti1,k2)

sample1<-minimal_html(texti2) tabu1 <- html_table(sample1, fill=TRUE)1 colnames(tabu1) <- c("V1","V2", "V3","V4", "V5","V6", "V7","V8" )

  1. print(tabu1)

sairaalassa00<-tabu1$V4 sairaalassa=as.integer(sairaalassa00)

teholla00<-tabu1$V5 teholla=as.integer(teholla00)

uusiatapauksia00<-tabu1$V3 uusiatapauksia0<-gsub(" ", "", uusiatapauksia00) uusia_tapauksia=as.integer(uusiatapauksia0)

uusiakuolleita00<-tabu1$V7 uusiakuolleita1=as.integer(uusiakuolleita00)

uusiakuolleita2<-uusiakuolleita1 uusiakuolleita2[uusiakuolleita2<0]<-0 uusia_kuolleita<-uusiakuolleita2

toipuneita00<-tabu1$V8 toipuneita01<-gsub(" ", "", toipuneita00) toipuneita0<-gsub("[^0-9.-]", "", toipuneita01) toipuneita=as.integer(toipuneita0)

tapauksia00<-tabu1$V2 tapauksia01<-gsub(" ", "", tapauksia00) tapauksia0<-gsub("[^0-9.-]", "", tapauksia01)

tapauksia=as.integer(tapauksia0)

kuolleita00<-tabu1$V6 kuolleita=as.integer(kuolleita00)


aktiivisia_tapauksia=tapauksia-kuolleita-toipuneita


  1. print (paivat1)
  2. print (teholla)
  3. print (sairaalassa)
  4. print (tapauksia)
  5. print (kuolleita)
  6. print (toipuneita)
  7. print (uusia_tapauksia)
  8. print (uusia_kuolleita)
  9. plot(paivat1,aktiivisia_tapauksia)


xy<-data.frame(paivat1, sairaalassa) xyz<-data.frame(paivat1, sairaalassa, teholla) dfout1<-data.frame(paivat1, aktiivisia_tapauksia, uusia_tapauksia, sairaalassa, teholla, uusia_kuolleita )

names(dfout1)<-c("Pvm", "Aktiivisia_tapauksia","Uusia_tapauksia", "Sairaalassa", "Teholla", "Uusia_kuolleita")

write.csv2(dfout1, "./sairaalassa.csv",row.names=FALSE )


if(tulosta_svg==2) { svg(filename=filename1, width=14, height=6, pointsize=12) #svg(filename=filename1, width=10, height=6, pointsize=12) #svg(filename=filename1, width=14, height=6, pointsize=12) }


if (plottaa==1) {

print ("Sairaalassa teholla päivittäiset kuolemat")

coeff <- 15

ylim.prim <- c(0, 100) ylim.sec <- c(0, 10)

b <- diff(ylim.prim)/diff(ylim.sec) a <- b*(ylim.prim[1] - ylim.sec[1])

#stop(-1)

dfm<-data.frame(paivat1, uusia_tapauksia, sairaalassa, teholla, uusia_kuolleita, aktiivisia_tapauksia)


#dfm2<-data.frame(paivat1, uusia_tapauksia, sairaalassa, teholla)


# ggplot(dfm, aes(x=paivat1), color="Potilaita", fill="Potilaita") + # geom_line(aes(y=sairaalassa, color="Sairaalassa"), size=2)+ # geom_line(aes(y=teholla, color="Teholla"), size=2)+ # geom_col( aes(y=uusia_kuolleita, color="Uusia kuolleita"), size=2)+ # scale_color_manual(name="Potilaita",breaks = c("Sairaalassa", "Teholla", "Uusia kuolleita"), # values=c("orange","red", "black") )


 	ggplot(dfm, aes(x=paivat1), color="Potilaita", fill="Potilaita") +
 	xlim(as.Date(datelimits1, format="%d/%m/%Y") )+
   theme_light()+
 	geom_col(aes(y= a + uusia_kuolleita*b, color="Uusia kuolleita"), fill="black",size=2)+

geom_line(aes(y=sairaalassa, color="Sairaalassa"),fill="white", size=2)+ geom_line(aes(y=teholla, color="Teholla"), fill="white",size=2)+ scale_y_continuous("Sairaalassa/teholla", sec.axis = sec_axis(~ (. - a)/b, name = "Kuolleita/pv")) +

scale_color_manual(name="Potilaita",breaks = c("Sairaalassa", "Teholla", "Uusia kuolleita"),

                       values=c("orange","red", "black") ) +
  	#scale_fill_manual(name="Potilaita",breaks = c("Sairaalassa", "Teholla", "Uusia kuolleita"),
   #                    values=c("orange","red", "black") ) +                     
                       
   ggtitle("Koronan takia sairaalassa - 2020/2021") +

xlab("Kuukausi") +

   theme(axis.line.y.right = element_line(color = "black"), 

axis.ticks.y.right = element_line(color = "black"), axis.text.y.right = element_text(color = "black"), axis.title.y.right = element_text(color = "black")

       ) +
    
    		theme(axis.line.y.left = element_line(color = "darkred"), 

axis.ticks.y.left = element_line(color = "darkred"), axis.text.y.left = element_text(color = "darkred"), axis.title.y.left = element_text(color = "darkred")

       ) +
       
       theme(title=element_text(size=18, face="bold"), 

axis.text=element_text(size=18,face="bold"), axis.title=element_text(size=18,face="bold"), legend.title=element_text(size=18, face="bold"), legend.text=element_text(size=18, face="bold") )

}


if(tulosta_svg==2) { dev.off() print("Ggplot svg done.") }



Licensing

edit
I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.

File history

Click on a date/time to view the file as it appeared at that time.

(newest | oldest) View (newer 10 | ) (10 | 20 | 50 | 100 | 250 | 500)
Date/TimeThumbnailDimensionsUserComment
current08:58, 12 March 2021Thumbnail for version as of 08:58, 12 March 20211,254 × 432 (56 KB)Merikanto (talk | contribs)Upload
13:32, 26 February 2021Thumbnail for version as of 13:32, 26 February 20211,056 × 407 (69 KB)Merikanto (talk | contribs)Update
12:07, 13 February 2021Thumbnail for version as of 12:07, 13 February 20211,155 × 581 (68 KB)Merikanto (talk | contribs)Updating
13:19, 16 January 2021Thumbnail for version as of 13:19, 16 January 2021932 × 563 (55 KB)Merikanto (talk | contribs)Upload
08:52, 1 January 2021Thumbnail for version as of 08:52, 1 January 2021918 × 517 (42 KB)Merikanto (talk | contribs)Update of image
11:43, 15 December 2020Thumbnail for version as of 11:43, 15 December 20201,003 × 475 (41 KB)Merikanto (talk | contribs)Upload
10:55, 3 December 2020Thumbnail for version as of 10:55, 3 December 2020914 × 524 (35 KB)Merikanto (talk | contribs)Update
12:18, 17 November 2020Thumbnail for version as of 12:18, 17 November 2020911 × 475 (42 KB)Merikanto (talk | contribs)Uodate of plot
13:58, 24 October 2020Thumbnail for version as of 13:58, 24 October 2020911 × 503 (61 KB)Merikanto (talk | contribs)Update ob graph
11:46, 16 October 2020Thumbnail for version as of 11:46, 16 October 2020992 × 493 (27 KB)Merikanto (talk | contribs)Update
(newest | oldest) View (newer 10 | ) (10 | 20 | 50 | 100 | 250 | 500)

The following page uses this file:

Metadata