ifelse sqlite
library(DBI) library(openxlsx) library(tidyverse) library(magrittr) library(hablar) con <- dbConnect(RSQLite::SQLite(), "~/Downloads/phone.db") dbListTables(con) phones <- dbGetQuery(con, "select * from phones") #phones <- tbl(con,sql("select * from phones")) %>% collect() regions <- dbGetQuery(con, "select * from regions") phones %<>% left_join(regions,by=c('region_id'='id')) %>% select(number,province,city,zip_code,area_code) dbDisconnect(con) df2015 <- read.xlsx('./Downloads/甘肃全国12320数据至-20200223.xlsx',sheet = 1) %>% mutate(year=2015) df2016 <- read.xlsx('./Downloads/甘肃全国12320数据至-20200223.xlsx',sheet = 2) %>% mutate(year=2016) df2017 <- read.xlsx('./Downloads/甘肃全国12320数据至-20200223.xlsx',sheet = 3) %>% mutate(year=2017) df2018 <- read.xlsx('./Downloads/甘肃全国12320数据至-20200223.xlsx',sheet = 4) %>% mutate(year=2018) df