File:Uudet covid-19 tapaukset viikoittain 1.svg

Original file(SVG file, nominally 900 × 540 pixels, file size: 103 KB)

Captions

Captions

New Covid-19 cases by week in Finland

Summary

edit
Description
English: New COVID-19 cases by week in Finland, year 2020 weeks 9-19 only. Viikkojen 9-19 uudet koronavirustapausket vuonna 2020.
Date
Source Own work
Author Merikanto

This image is based on THL open data.

https://thl.fi/fi/tilastot-ja-data/aineistot-ja-palvelut/avoin-data/varmistetut-koronatapaukset-suomessa-covid-19-

Data is downloaded with R script from THL database.

Script output is further proccessced with Geany Result file is visualized with LibreOffice

Rajapinnan osoite: https://sampo.thl.fi/pivot/prod/api/epirapo/covid19case.json

Aineiston aihealue: epirapo

Aineiston nimi: covid19case Covid-19 weekly new cases in Finland, 2020, during weeks 1-51 only: "";"viikko";"tapauksia" "1";1;1 "2";2;0 "3";3;0 "4";4;0 "5";5;1 "6";6;0 "7";7;1 "8";8;1 "9";9;7 "10";10;34 "11";11;317 "12";12;540 "13";13;642 "14";14;966 "15";15;931 "16";16;790 "17";17;736 "18";18;623 "19";19;617 "20";20;396 "21";21;221 "22";22;163 "23";23;99 "24";24;54 "25";25;51 "26";26;53 "27";27;46 "28";28;38 "29";29;43 "30";30;56 "31";31;84 "32";32;169 "33";33;175 "34";34;192 "35";35;156 "36";36;236 "37";37;354 "38";38;470 "39";39;719 "40";40;1130 "41";41;1626 "42";42;1276 "43";43;1246 "44";44;1457 "45";45;1416 "46";46;1651 "47";47;2601 "48";48;3137 "49";49;3015 "50";50;2906 "51";51;2328 "52";52;1654 "53";53;1847 "54";1;1948 "55";2;1770 "56";3;2352 "57";4;2714 "58";5;2610 "59";6;2555 "60";7;3554 "61";8;3993 "62";9;4456 "63";10;4944 "64";11;4711 "65";12;4186 "66";13;3272 "67";14;2553 "68";15;1937 "69";16;1609 "70";17;1388 "71";18;1503 "72";19;1432 "73";20;1320 "74";21;890 "75";22;728 "76";23;558 "77";24;542 "78";25;971 "79";26;1294 "80";27;1698 "81";28;2245 "82";29;2925 "83";30;4660 "84";31;5098 "85";32;5186 "86";33;4393 "87";34;4207 "88";35;3893 "89";36;3151 "90";37;2818 "91";38;3016 "92";39;3888 "93";40;4251 "94";41;3729 "95";42;3697 "96";43;4211 "97";44;5163 "98";45;5998 "99";46;7497 "100";47;8181 "101";48;9546 "102";49;10642 "103";50;13824 "104";51;21909 "105";52;44070 "106";53;58975 "107";1;59935 "108";2;56199 "109";3;47727 "110";4;44272 "111";5;45223 "112";6;42409 "113";7;41551 "114";8;38091 "115";9;46991 "116";10;49155 "117";11;48809 "118";12;40417


R script to download data
###################################
##
## thl finland weekly covid cases
## r script, thl api 12/2020
##
## 13.4.2022 v 0000.0003
##
##
##

#install.packages("ggplot2", "rjstat", repos ="https://ftp.acc.umu.se/mirror/CRAN/")
	
	
		
	
library(rjstat)
library(ggplot2)



nth_element <- function(vector, starting_position, n) { 
  vector[seq(starting_position, length(vector), n)] 
  }

## HUOMAA ERI VUOSIEN VIIKKONUMEROT!

viikko1<-1 # vuoden 2020 viikko
viikko2<-52+13 ## vuoden 2021 viikko

tulosta_svg=1
 
peruspolku="/Users/himot/akor1/"
ulosnimi="viikottaiset_koronatapaukset_2020.svg"
polkunimi=paste0(peruspolku, ulosnimi)
 
 
spanni=0.1 ## silitetyn käyrän vakio 1 sileä 0.1 mutkalla
metodi="loess" ## silitetyn käyrän laskutapa   
   
viikkokanta=53 # vuosi 2020
viikko2=viikko2+viikkokanta 
 
      
url_base <- "https://sampo.thl.fi/pivot/prod/fi/epirapo/covid19case/fact_epirapo_covid19case.json"
request <- "?column=dateweek20200101-509030"
## kuolemat
#request <- "?column=dateweek20200101-509030&filter=measure-492118"
url <- paste0(url_base, request)
cube <- fromJSONstat(url, naming = "label", use_factors = F, silent = T)
res00 <- cube[[1]]

head(res00, 20)

viikot <- viikko1:viikko2
 
viikkonimet<-res00[viikko1:viikko2,1]

viikkonimet2=viikot

#viikkonimet

len1=length(viikkonimet)

#len1


for (n in 1:len1) {
	viini<-n
	if (viini>53) {
		viini2=viini-53
		viikkonimet2[n]<-viini-53
		if (viini2>53) {
		viikkonimet2[n]<-viini2-53
		}
		
    }
}



lukumaarat<-as.integer(res00[viikko1:viikko2,2])
 
lukumaarat[is.na(lukumaarat)] <- 0 

# print (lukumaarat)
 
 viikkonimet2
 lukumaarat
 
 #viikkojono
  viikkonimet3<-as.character(viikkonimet2)


   print (viikkonimet3)
#  stop(-1)
  
   viikot4=nth_element(viikot,1,10)
   nimet4=nth_element(viikkonimet3,1,10)

  df1<-data.frame(viikot, lukumaarat) 
  df2<-data.frame(viikkonimet2, lukumaarat)  
  df3<-data.frame(viikot,viikkonimet3, lukumaarat) 
  
  
  
  head(df3)
 
 if(tulosta_svg==1)
{
	
	svg(filename=ulosnimi, width=10, height=6, pointsize=24)

}

 
  
p<-ggplot(data=df3, aes(x=viikot, y=lukumaarat)) +
 geom_bar(stat="identity",fill="blue")+
 scale_x_continuous(breaks=viikot4 , labels=nimet4 )+


ggtitle("Viikottaiset koronavirustapaukset Suomessa v. 2020 - 2022") +
theme(plot.title = element_text(hjust = 1.5))+
  xlab("Viikko 2020-2022") + ylab("Koronatapauksia viikossa")+
  geom_bar(stat="identity",fill="blue")+
  theme_minimal()+
  theme(text = element_text(size=20),
		axis.text.x = element_text(color = "grey20", size = 18, hjust = .5, vjust = .5, face = "plain"),
        axis.text.y = element_text(color = "grey20", size = 18,  hjust = 1, vjust = 0, face = "plain"),  
        axis.title.x = element_text(color = "grey20", size = 20, hjust = .5, vjust = 0, face = "plain"),
        axis.title.y = element_text(color = "grey20", size = 20,  hjust = .5, vjust = .5, face = "plain"))
        
 # geom_smooth(color="#5f005f", fill="#00ff00",span=spanni, method=metodi, level=0.99, size=6, linetype="solid")

  
  
  plot(p)
   
 if(tulosta_svg==1)
 {
  dev.off()
 }


 names(df2)<-c("viikko", "tapauksia")
 write.csv2(df2, "./weekly1.csv")
  
 #write.csv2(df2, "/Users/himot/akor1/weekly1.csv")
 
  print("Run 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
current11:09, 24 July 2022Thumbnail for version as of 11:09, 24 July 2022900 × 540 (103 KB)Merikanto (talk | contribs)update
18:14, 13 April 2022Thumbnail for version as of 18:14, 13 April 2022900 × 540 (114 KB)Merikanto (talk | contribs)Update
08:23, 8 December 2021Thumbnail for version as of 08:23, 8 December 2021900 × 540 (105 KB)Merikanto (talk | contribs)update
05:57, 20 September 2021Thumbnail for version as of 05:57, 20 September 2021900 × 540 (100 KB)Merikanto (talk | contribs)Update
06:47, 22 August 2021Thumbnail for version as of 06:47, 22 August 2021900 × 540 (98 KB)Merikanto (talk | contribs)update
10:02, 26 July 2021Thumbnail for version as of 10:02, 26 July 2021900 × 540 (96 KB)Merikanto (talk | contribs)Update
07:39, 2 July 2021Thumbnail for version as of 07:39, 2 July 2021900 × 540 (94 KB)Merikanto (talk | contribs)Update
07:16, 8 June 2021Thumbnail for version as of 07:16, 8 June 2021900 × 540 (93 KB)Merikanto (talk | contribs)Update
06:56, 26 May 2021Thumbnail for version as of 06:56, 26 May 2021900 × 540 (92 KB)Merikanto (talk | contribs)Update
11:04, 13 May 2021Thumbnail for version as of 11:04, 13 May 2021900 × 540 (91 KB)Merikanto (talk | contribs)update
(newest | oldest) View (newer 10 | ) (10 | 20 | 50 | 100 | 250 | 500)

There are no pages that use this file.

Metadata