博文

目前显示的是 十二月, 2019的博文

docker

curl -fsSL https://get.docker.com -o get-docker.sh sudo sh get-docker.sh sudo usermod -aG docker xuefliang sudo chmod a+rw /var/run/docker.sock docker search portainer docker pull portainer/portainer docker volume create portainer_data docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer docker pull teddysun/v2ray must create a configuration file /etc/v2ray/config.json mkdir -p /etc/v2ray docker run -d -p 1080:1080 --name v2ray --restart=always -v /etc/v2ray:/etc/v2ray teddysun/v2ray docker pull rocker/r-base docker run --rm -ti rocker/r-base docker pull rocker/r-apt docker pull rocker/rstudio-daily docker run -e PASSWORD=yourpassword --rm -p 8787:8787 rocker/rstudio docker pull rocker/tidyverse docker pull rocker/r-ver docker pull rocker/verse docker pull rocker/geospatial docker pull rocker/binder docker pull rocker/shiny docker run -d --name rstudio -v /home/xuefliang/Documents:/home/rstudio

Choropleth Map in ggplot2

library(tidyverse) states<-as.data.frame(state.x77) %>%   mutate(region=tolower(rownames(states))) states_map <- map_data("state")   fact_join <- left_join(states_map, states, by = "region") ggplot(fact_join, aes(long, lat, group = group))+   geom_polygon(aes(fill = Population), color = "white")+   # 将map颜色设置为“岩浆”色,简称为“A”,共有“A”,“B”,“C”,“D”和“E”五种   scale_fill_viridis_c(option = "C")+   theme_classic()

dtplyr使用

devtools::install_github("tidyverse/dtplyr") library(tidyverse) library(dtplyr) mtcars2 <- lazy_dt(mtcars) mtcars2 %>%   filter(wt < 5) %>%   mutate(l100k = 235.21 / mpg) %>% # liters / 100 km   group_by(cyl) %>%   summarise(l100k = mean(l100k)) %>%   as_tibble()