博文

目前显示的是 九月, 2019的博文

inspectdf

#检查变量类型分布 inspect_types(stations_norway) %>%   show_plot() #检查字符变量分布 #high_cardinality 将少数类别合并   stations_norway %>%     select_if(is.character)%>%     inspect_cat() %>%     show_plot(high_cardinality = 1) #检查数值变量分布 stations_norway %>%   select_if(is.numeric) %>%   inspect_num() %>%   show_plot() #检查变量缺失值分布 stations_norway %>%   inspect_na() #检查字符变量不平衡性分布 stations_norway %>%   select_if(is.character)%>%   inspect_imb()%>%   show_plot()

缺失值替代

sqltxt <-"select ym_mc,xt_djjgdm from inoc_jzjl where jz_sj > =to_date('2018-01-01','yyyy-mm-dd') and jz_sj <=to_date('2018-12-31','yyyy-mm-dd') and sfmf='1'" dzmc <- con %>%   tbl(in_schema('ipvsdb','SYS_XZQH_ZZJG')) %>%   select(DZMC,DZBM) %>%   filter(str_length(DZBM)==4) %>%   collect() %>%   clean_names() vacc<- tbl(con,sql(sqltxt)) %>%   collect() %>%   clean_names()%>%   mutate(shi=str_sub(xt_djjgdm,1,4)) %>%   group_by(shi,ym_mc) %>%   summarise(n=n()) %>%   left_join(dzmc,by=c('shi'='dzbm')) %>%   drop_na(dzmc) %>%   spread(ym_mc,n) %>%   mutate_all(list(~replace_na(.,0)))   mutate_if(is.numeric,list(~replace_na(.,0))) write.csv(vacc,'~//My Pictures//vacc.csv')

分市州计算每电子监管码接种剂次数

xzqh<- con %>%   tbl(in_schema('ipvsdb','SYS_XZQH_ZZJG')) %>%   select(DZMC,DZBM) %>%   filter(str_length(DZBM)==4) %>%   collect() %>%   clean_names() sql_txt <- "select grda_code,ym_bm,ym_mc,xt_djjgdm,jz_sj,jz_zc,dzjgm,substr(xt_djjgdm,1,4) as shi from INOC_JZJL where jz_sj>=to_date('2018-01-01','yyyy-mm-dd') and jz_sj<=to_date('2019-12-31','yyyy-mm-dd') and ym_bm='0311'" sunhao <- tbl(con,sql(sql_txt)) %>%   collect() %>%   clean_names() %>%   filter(!is.na(dzjgm)) %>%   mutate(year=str_sub(jz_sj,1,4)) %>%   group_by(shi,year) %>%   summarise(count=n(),dzn=n_distinct(dzjgm)) %>%   mutate(jici=round(count/dzn,2)) %>%   left_join(xzqh,by = c("shi"="dzbm"))

单位数用户数扫码数

#Sys.setenv(NLS_LANG="AMERICAN_AMERICA.ZHS16GBK") Sys.setenv(NLS_LANG="AMERICAN_AMERICA.UTF8") library(ROracle) library(tidyverse) library(dbplyr) library(knitr) library(magrittr) library(lubridate) library(janitor) drv <- dbDriver("Oracle") connect.string <- paste(   "(DESCRIPTION=",   "(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.30.12)(PORT=1521))",   "(CONNECT_DATA=(SERVICE_NAME=JZDB1)))", sep = "") con <- dbConnect(drv, username = "", password = "",                  dbname = connect.string) dqmc <- con %>%   tbl(in_schema('ipvsdb','SYS_XZQH_ZZJG')) %>%   select(DZMC,DZBM) %>%   filter(str_length(DZBM)==4) %>%   collect() %>%   clean_names() %>%   remove_empty(c("rows", "cols")) #单位数 sqltxt <- "select * from sys_org" tmp <- tbl(con,sql(sqltxt)) %>%   collect() %>%   clean_names() %>

分市州用户管理

Sys.setenv(NLS_LANG="AMERICAN_AMERICA.ZHS16GBK") library(ROracle) library(tidyverse) library(dbplyr) library(knitr) library(magrittr) library(stringr) library(lubridate) library(janitor) drv <- dbDriver("Oracle") connect.string <- paste(   "(DESCRIPTION=",   "(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.30.12)(PORT=1521))",   "(CONNECT_DATA=(SERVICE_NAME=JZDB1)))", sep = "") con <- dbConnect(drv, username = "", password = "",                  dbname = connect.string) sqltxt <-"select * from sys_user" user<- tbl(con,sql(sqltxt)) %>%   collect() %>%   clean_names()%>%   mutate(shi=str_sub(jgbm,1,4)) %>%   group_by(shi,jlzt) %>%   summarise(n=n())   spread(jlzt,n) tmp <- con %>%   tbl(in_schema('ipvsdb','SYS_XZQH_ZZJG')) %>%   select(DZMC,DZBM) %>%   filter(str_length(DZBM)==4) %>%   collect() %>%   clean_names()

tidyr包

library(tidyr) library(dplyr) data(who) names(who) #pivot_longer类似gather who %>% pivot_longer(   cols = new_sp_m014:newrel_f65,   names_to = c("diagnosis", "gender", "age"),   names_pattern = "new_?(.*)_(.)(.*)",   values_to = "count",   values_drop_na = TRUE ) stocks <- tibble(   time = as.Date('2009-01-01') + 0:9,   X = rnorm(10, 0, 1),   Y = rnorm(10, 0, 2),   Z = rnorm(10, 0, 4) ) stocks %>% gather("stock", "price", -time) stocks %>% pivot_longer(-time,                         names_to = 'stock',                         values_to = 'price') stocksm <- stocks %>%   pivot_longer(cols = c(X,Y,Z),                names_to = 'stock',                values_to = 'price') stocksm %>% spread(stock, price) #填补缺失值 stocksm %>% pivot_wider(names_from = stock,                         values_from = price,                         values_fill = list(seen = 0)) #每行有4个

sqlite

sudo apt-get install sqlite3 sqlitebrowser

分疫苗分针次接种率

Sys.setenv(NLS_LANG="AMERICAN_AMERICA.ZHS16GBK") library(ROracle) library(tidyverse) library(dbplyr) library(knitr) library(magrittr) library(stringr) library(lubridate) library(janitor) ym_jzl <- function(csrq_begin,csrq_end,static_date,ymbm,jzzc,month,jcqk,czlx,level,condition) {   static_date <- if_else(condition,static_date - ddays(12*30),static_date)     temp <- con %>%     tbl(in_schema('ipvsdb','GRDA_ET')) %>%     filter(between(CSRQ,to_date(csrq_begin,"YYYY-MM-DD"),                    to_date(csrq_end,"YYYY-MM-DD")) &  JCQK==jcqk & CZLX==czlx) %>%     select(GRDA_ET_LSH,GLDW_BM,CSRQ)     jzjl <-  con %>%     tbl(in_schema('ipvsdb','INOC_JZJL')) %>%     right_join(temp,by=c('GRDA_ET_LSH'='GRDA_ET_LSH')) %>%     select(CSRQ,YM_BM,JZ_ZC,GRDA_ET_LSH,GLDW_BM) %>%     collect() %>%      clean_names() %>%     mutate(csrq=as.Date(csrq))

计算日期间隔

library(lubridate) library(janitor) as.period(ymd('2019-09-06')-ymd('2019-01-09'),unit = 'days')

anbox

sudo add-apt-repository ppa:morphis/anbox-support sudo apt install -y anbox-modules-dkms sudo modprobe ashmem_linux sudo modprobe binder_linux sudo snap install --devmode --beta anbox sudo apt install wget lzip unzip squashfs-tools wget https://raw.githubusercontent.com/geeks-r-us/anbox-playstore-installer/master/install-playstore.sh chmod +x install-playstore.sh sudo ./install-playstore.sh sudo ./install-playstore.sh --clean anbox.appmgr sudo /snap/anbox/current/bin/anbox-bridge.sh start sudo /snap/anbox/current/bin/anbox-bridge.sh restart https://blog.csdn.net/ZhangRelay/article/details/84465548 https://www.linuxuprising.com/2018/07/anbox-how-to-install-google-play-store.html