library(showtext) library(readxl) library(ggplot2) library(dplyr) #to select certain entries only library(knitr) #for table formatting library(kableExtra)
showtext_auto()
setwd(‘~/Desktop/FS/law/R’)
RData <- read_excel(“stats_all.xlsx”, sheet = “Sheet1”) head(RData)
#########################################省内数据比较########################################## ###############################################################################################
selected_cities_1 <- c(“佛山”, “东莞”, “惠州”, “江门”, “肇庆”, “中山”, “珠海”) filtered_data_1 <- Rdata %>% filter(city_name %in% selected_cities_1)
head(filtered_data_1)
selected_data_economy_1 <- filtered_data_1 %>% select(city_name, GDP, primary_sec, primary_sec_proportion, secondary_sec, secondary_sec_proportion, tertiary_sec, tertiary_sec_proportion) selected_data_economy_1_renamed <- selected_data_economy_1 %>% rename( “GDP (亿元)” = GDP, “第一产业增值 (亿元)” = primary_sec, “第一产业占比” = primary_sec_proportion, “第二产业增值 (亿元)” = secondary_sec, “第二产业占比” = secondary_sec_proportion, “第三产业增值 (亿元)” = tertiary_sec, “第三产业占比” = tertiary_sec_proportion )
view_selected_data_economy_1 <- kable(selected_data_economy_1, caption = “广东省内近似城市社会经济运行数据”, format = “html”, row.names = TRUE) %>% kable_styling(bootstrap_options = c(“striped”, “hover”), full_width = F, font_size = 12, position = “left”) view_selected_data_economy_1