This file contains hidden or 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(request) | |
library(rvest) | |
library(urltools) | |
library(dplyr) | |
library(data.table) | |
setwd('/Volumes/GoogleDrive/My Drive/生資系系務/系所評鑑資料/參考資料/analysis/系所評鑑分析/') | |
grepSyllabusURL <- function(year, term, lecturer){ | |
httr::set_config(httr::user_agent("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Safari/605.1.15")) |
This file contains hidden or 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) | |
# shell, split file by empty lines | |
system('mkdir workspace') | |
system('cd workspace; split -p "^$" ../1098.txt') | |
files <- list.files('./workspace', pattern = '^x', full.names = TRUE) | |
n <- floor(length(files)/5) | |
for ( i in 0:(n-1) ){ |
This file contains hidden or 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(raster) | |
library(rgdal) | |
rasterFiles <- list.files('../temp/', pattern = '.tif', | |
full.names = TRUE) | |
rs <- raster::stack(rasterFiles) | |
# calculate warmth index | |
# 1. create an empty raster layer and fill it with zero | |
wi <- rs[[1, ]]*0 |
This file contains hidden or 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: "Untitled" | |
author: "your name" | |
date: "3/27/2019" | |
header-includes: | |
- \usepackage{fontspec} | |
- \usepackage{xeCJK} | |
- \setCJKmainfont{Songti TC} # change to your font names | |
output: | |
pdf_document: |
This file contains hidden or 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
# load rvest package | |
library(rvest) | |
prefix <- 'http://www.ncyu.edu.tw' | |
acaLawPage <- 'http://www.ncyu.edu.tw/academic/law_list.aspx?pages=' | |
totalPageCount <- paste(acaLawPage, 0, sep = "") %>% | |
read_html() %>% # use read_html to read out URL | |
html_nodes(xpath = '//span[@id="pagecount"]') %>% # find the path of pagecount | |
html_text() %>% # convert it into plain text |
This file contains hidden or 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(rvest) | |
library(curl) | |
prefix <- 'http://www.ncyu.edu.tw' | |
acaLawPage <- 'http://www.ncyu.edu.tw/academic/law_list.aspx?pages=' | |
acaLawPage1 <- read_html('http://www.ncyu.edu.tw/academic/law_list.aspx?pages=0') | |
# get page counts | |
totalPages <- acaLawPage1 %>% html_nodes(xpath = '//span[@id="pagecount"]') %>% |
This file contains hidden or 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
plot | species | individuals | |
---|---|---|---|
DG01 | 印度牛膝 | 5 | |
DG01 | 大花咸豐草 | 15 | |
DG01 | 烏面馬 | 1 | |
DG01 | 短穎馬唐 | 2 | |
DG01 | 綠珊瑚 | 1 | |
DG01 | 酢漿草 | 10 | |
DG01 | 野莧菜 | 3 | |
DG01 | 銀合歡 | 20 | |
DG01 | 馬櫻丹 | 12 |
This file contains hidden or 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
mothurDir <- '~/Downloads/mothur/' | |
fastaFile <- './1060501B_cut3_without_N.fas' | |
phylipFile <- paste(strsplit(fastaFile, '.fas')[1], '.phylip.dist', sep='') | |
listFile <- paste(strsplit(fastaFile, '.fas')[1], '.phylip.fn.list', sep='') | |
mothur(mothurDir, subfunc='dist.seqs', | |
fasta=fastaFile, calc='onegap', cutoff=0.03, countends=F, output='lt') | |
mothur(mothurDir, subfunc='cluster', | |
phylip=phylipFile, |
This file contains hidden or 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
#!/usr/bin/env sh | |
calcWI_tmp() { | |
for (( i=1; i<=12; i++ )) | |
do | |
if [ ${i} -lt 10 ] ; then | |
num=0${i} | |
else | |
num=${i} | |
fi | |
gdal_calc.py --format=GTiff --overwrite -A tif/tavg${num}.tif --NoDataValue=-9999 \ |
This file contains hidden or 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
# Original GPS format from https://www.sno.phy.queensu.ca/~phil/exiftool/geotag.html | |
# | |
#[HEAD]<?xml version="1.0" encoding="utf-8"?> | |
#[HEAD]<gpx version="1.0" | |
#[HEAD] creator="ExifTool $ExifToolVersion" | |
#[HEAD] xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
#[HEAD] xmlns="http://www.topografix.com/GPX/1/0" | |
#[HEAD] xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd"> | |
#[HEAD]<trk> | |
#[HEAD]<name>航跡:2018-07-31</name> |