Compare commits
	
		
			No commits in common. "cd3b9b22917519f8427a25cd7484316948aa2e80" and "7e76ea34a8dfdbd83275716c4493a5f97673ce2c" have entirely different histories.
		
	
	
		
			cd3b9b2291
			...
			7e76ea34a8
		
	
		
							
								
								
									
										8
									
								
								BAK.V1.R
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								BAK.V1.R
									
									
									
									
									
								
							| @ -24,7 +24,7 @@ df_Hauptbereich <- select(df_bak, c("Name.des.Akteurs", | ||||
|                                "Tätigkeitsebene..räumlich.", | ||||
|                                "materielles...mobiles.Kulturerbe",  | ||||
|                                "materielles...immobiles.Kulturerbe",  | ||||
|                                "immaterielles.Kulturerbe", "Kanton")) %>%  | ||||
|                                "immaterielles.Kulturerbe")) %>%  | ||||
|                     dplyr::rename("Institution"="Name.des.Akteurs", | ||||
|                                   "Akteurshaupttypen" = "Haupttypen.rechtlicher.Institutionalisierung..Finanzierung..Auftrag..Organisationsform.", | ||||
|                                   "Taetigkeitsebene" = "Tätigkeitsebene..räumlich." )  | ||||
| @ -50,7 +50,7 @@ df_Hauptbereich_bin <- df_Hauptbereich %>%  mutate( | ||||
| 
 | ||||
|   ##Abbildung 7 Anzahl Akteure (nach Haupttypen) in drei Hauptbereichen (Haupttypen) Kulturerbe | ||||
| df_Hauptbereich_bin <- df_Hauptbereich_bin[!(df_Hauptbereich_bin$Akteurshaupttypen ==""),] | ||||
| table7 <- aggregate(cbind(MM.Bin, MI.Bin, I.Bin) ~ Akteurshaupttypen+Kanton,  | ||||
| table7 <- aggregate(cbind(MM.Bin, MI.Bin, I.Bin) ~ Akteurshaupttypen,  | ||||
|                                data=df_Hauptbereich_bin, | ||||
|                                FUN=sum) %>%  | ||||
|   dplyr::rename("Materielles + mobiles Kulturerbe"="MM.Bin", | ||||
| @ -247,7 +247,7 @@ Abb11.2=table11.2 %>%  kable(caption = "Abbildung 11: Anzahl Akteure (nach Haupt | ||||
|   ##Abbildung 12: Anzahl Akteure (nach rechtlicher Organisationsform) nach Institutionalisierung des Auftrags | ||||
| df_Insti <- df_bak[c(7, 8, 9, 10)] %>% dplyr::rename("rechtl.Institutionalisiserung"="rechtliche.Institutionalisierung.des.Auftrags", | ||||
|                                                      "rechtl.Organisationsform" = "rechtliche.Organisationsform")  | ||||
| df_Insti$rechtl.Organisationsform <- plyr::revalue(df_Insti$rechtl.Organisationsform, c("privat: Stiftung"="Stiftung: privat", "staatlich/öffentlich: Behörde / Anstalt" = "Behörde/Anstalt",  | ||||
| df_Insti$rechtl.Organisationsform <- revalue(df_Insti$rechtl.Organisationsform, c("privat: Stiftung"="Stiftung: privat", "staatlich/öffentlich: Behörde / Anstalt" = "Behörde/Anstalt",  | ||||
|                                                                                           "privat: Verein/Verband" = "Verein: privat","hybrid: Kapitalgesellschaft" = "Kapitalgesellschaft: hybrid", | ||||
|                                                                                           "hybrid: Verein/Verband" = "Verein: hybrid", "privat: Einzelperson(en)"= "Einzelperson (privat)",  | ||||
|                                                                                           "hybrid: Stiftung" = "Stiftung: hybrid","privat: Genossenschaft" = "Genossenschaft: privat", | ||||
| @ -260,7 +260,7 @@ df_Insti12_count <- df_Insti %>% dplyr::group_by(rechtl.Institutionalisiserung,r | ||||
| table12.prep <- spread(df_Insti12_count, key=rechtl.Institutionalisiserung, value = count) | ||||
| table12.prep[is.na(table12.prep)] <- 0 | ||||
| 
 | ||||
| table12 <- table12.prep %>% janitor::adorn_totals("row") %>%  | ||||
| table12 <- table12.prep %>% adorn_totals("row") %>%  | ||||
|   arrange(match(rechtl.Organisationsform, c("Einzelperson (privat)", "Einzelunternehmen (privat)",  | ||||
|                                                 "Stiftung: privat", "Stiftung: staatlich/öffentlich", "Stiftung: hybrid", | ||||
|                                                 "Genossenschaft: privat", "Genossenschaft: staatlich/öffentlich", "Genossenschaft: hybrid", | ||||
|  | ||||
							
								
								
									
										93
									
								
								Heatmaps.R
									
									
									
									
									
								
							
							
						
						
									
										93
									
								
								Heatmaps.R
									
									
									
									
									
								
							| @ -1,93 +0,0 @@ | ||||
| rm(list=ls()) | ||||
| #######get required libraries####### | ||||
| library(ggplot2) | ||||
| library(dplyr) | ||||
| library(tidyverse) | ||||
| library(RSwissMaps) | ||||
| library(viridis) | ||||
| 
 | ||||
| #######set working direction and get the data | ||||
| setwd("~/BAK_Projekt") | ||||
| 
 | ||||
| #base | ||||
| mapCH <- mapCH2016 %>% dplyr::rename("bfs_nr"="can") | ||||
| 
 | ||||
| #create dataset on canton level | ||||
| df_bak <- read.csv("~/BAK_Projekt/Liste_BAK2.csv", sep = ";") | ||||
| 
 | ||||
| df_bak_red <- df_bak %>%  | ||||
|   dplyr::group_by(Kanton) %>%  | ||||
|   dplyr::summarise(count=n()) | ||||
| df_bak_red <- df_bak_red[!(df_bak_red$Kanton ==""),] | ||||
| df_bak_red$Kt <- c("AG", "AI", "AR", "BL", "BS", "BE", "FR", "GE", "GL", "GR", "JU", "LU", "NE",  | ||||
|                      "NW", "OW", "SH", "SZ", "SO", "SG", "TI", "TG", "UR", "VD", "VS", "ZG", "ZH") | ||||
| df_bak_red$bfs_nr <- as.integer(c("19", "16", "15", "13", "12", "2", "10", "25", "8", "18", "26", "3", "24",  | ||||
|                                  "7", "6", "14", "5", "11", "17", "21", "20", "4", "22", "23", "9", "1")) | ||||
| 
 | ||||
| #get coordinates (required reference system CH1903/LV03) | ||||
| mapCH.short <- mapCH[!duplicated(mapCH$bfs_nr),] | ||||
| df.map <- full_join(df_bak_red, mapCH.short, by="bfs_nr") %>%  | ||||
|   select("bfs_nr", "Kt", "name", "count", "bfs_nr", "long", "lat") | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| # Plotting sample data | ||||
| can.plot(df.map$bfs_nr, df.map$count, 2016,  | ||||
|          boundaries = "c", boundaries_size = 0.2, boundaries_color = "white", | ||||
|          title = "Verteilung der Institutionen auf Kantonsebene") | ||||
|   #geom_text(aes(x=df.map$long, y=df.map$lat ,label = df.map$Kt)) | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| ####Example for district map -> can be deleted | ||||
| # Generating sample data: | ||||
| dt.dis <- dis.template(2016) | ||||
| for(i in 1:nrow(dt.dis)){dt.dis$values[i] <- sample(c(300:700), 1)/1000} | ||||
| # Plotting sample data: | ||||
| dis.plot(dt.dis$bfs_nr, dt.dis$values, 2016, | ||||
|          boundaries = "c", | ||||
|          title = "Beispiel auf Bezirksebene (random data)") | ||||
| # Plotting sample data for the canton of Aargau: | ||||
| dis.plot(dt.dis$bfs_nr, dt.dis$values, 2016, cantons = c("GR"), | ||||
|          lakes = c("none"), | ||||
|          title = "Beispiel Kanton Graubünden (Bezirksebene)")  | ||||
| 
 | ||||
| 
 | ||||
|    | ||||
| 
 | ||||
| 
 | ||||
| #Example Dataset | ||||
| library(scatterpie) | ||||
| table7 <- table7 %>% dplyr::rename("name"="Kanton") | ||||
| table7 <- table7[!(table7$name ==""),] | ||||
| test <- full_join(df.map, table7, by="name") | ||||
| test$radius <- 6*abs(rnorm(nrow(test))) | ||||
| 
 | ||||
| p <- can.plot(df.map$bfs_nr, df.map$count, 2016,  | ||||
|                boundaries = "c", boundaries_size = 0.2, boundaries_color = "white", | ||||
|                title = "Verteilung der Institutionen auf Kantonsebene") + | ||||
|   coord_quickmap() | ||||
| 
 | ||||
| p + geom_scatterpie(aes(x=long, y=lat, group=bfs_nr, r=radius), | ||||
|                   data=test, cols=c(11:13), color=NA, alpha=.8)  | ||||
| 
 | ||||
|   geom_scatterpie_legend(test$radius, x=-160, y=-55) | ||||
| 
 | ||||
|    | ||||
|    | ||||
|    | ||||
|    | ||||
|    | ||||
|    | ||||
|   test %>%  | ||||
|     select(c(11:13)) %>%  | ||||
|     pivot_longer(cols = names(.)) %>%  | ||||
|     ggplot(aes(x = value, y = 1, fill = name)) +  | ||||
|     geom_col(position = "stack") +  | ||||
|     coord_polar() +  | ||||
|     theme_void() | ||||
|    | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user