This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(maps) | |
library(shiny) | |
library(stringr) | |
worlddf <- map("world") | |
# restrict selection to coutries only | |
locations <- worlddf$names | |
countries <-subset(locations,is.na(str_locate(locations,":"))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd /srv/ghost/content/themes | |
rm -rf Perfetta-Free-Ghost-Theme/ | |
git clone https://github.com/Jianghao/Perfetta-Free-Ghost-Theme.git | |
cd /srv/ghost/ | |
forever restart index.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -------------------------- | |
# main | |
# -------------------------- | |
### initial | |
library(plyr) | |
library(dplyr) | |
library(data.table) | |
setwd("~/path-to-folder/") | |
### Fast merge Rdata with FastMergeDF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# title : 01-Visualize.R | |
# purpose : Visualize worldclim.org data | |
# reference : rasterVis package help page | |
# producer : Prepared by Jianghao Wang | |
# address : In IGSNRR, CAS, China | |
# ---------------------------------------------------------- | |
library(plyr) | |
library(rasterVis) | |
library(rgdal) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# install.package("mailR") | |
library(mailR) | |
send.mail(from = "email address", | |
to = "email address", | |
subject = paste0(), | |
body = "", | |
smtp = list(host.name = "smtp.qq.com", port = 465, | |
user.name = "hellowangjh@qq.com", passwd = "passwd", ssl = TRUE), | |
authenticate = TRUE, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if("mailR" %in% rownames(installed.packages()) == FALSE) install.packages("mailR") | |
library(mailR) | |
send.mail.qq <- function(subject, passwd, body="Hello World"){ | |
mailR::send.mail(from = "hellowangjh@qq.com", | |
to = "hellowangjh@qq.com", | |
subject = subject, | |
body = body, | |
smtp = list(host.name = "smtp.qq.com", port = 465, | |
user.name = "hellowangjh@qq.com", passwd = passwd, ssl = TRUE), | |
authenticate = TRUE, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Hexo Configuration | |
## Docs: http://hexo.io/docs/configuration.html | |
## Source: https://github.com/hexojs/hexo/ | |
# Site | |
title: Jianghao Wang | |
subtitle: Writing 1000 Words a Day Changes My Life | |
description: Walk steps step by step | |
author: Jianghao | |
# language: zh-Hans |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
setwd("D:/Cooperation/Caojing/Geocoding/") | |
# library(foreign) | |
# data <- read.dta("pollution_cen.dta") | |
# ## not a Stata version 5-12 .dta file | |
## on windows only | |
install.packages("haven") | |
require(haven) | |
df <- read_dta('pollution_cen.dta') | |
for(i in 1:ncol(df)){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(data.table) | |
library(rgdal) | |
library(foreign) | |
setwd("C:/Users/Jianghao/Desktop/geocoding/") | |
data <- fread("geocoding.csv") | |
head(data) | |
coordinates(data) <- ~ lon + lat | |
proj4string(data) <- CRS("+proj=longlat +datum=WGS84") | |
writeOGR(obj = data, dsn = "geocoding.shp", layer = "geocoding", driver = "ESRI Shapefile") | |
write.dbf(dataframe = data@data, file = "geocoding.dbf") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#' Get the detail of ncdf4 file variable as a data.frame | |
#' | |
#' @param nc opened nc4 files | |
#' @return data.frame of variable information | |
#' @keywords nc attibute | |
#' @export | |
#' @examples | |
#' ncatt_get_df(nc) | |
ncatt_get_df <- function(nc, items=c("long_name", "units")){ | |
options(stringsAsFactors=FALSE) |
OlderNewer