Skip to content

Instantly share code, notes, and snippets.

View seilanhiep's full-sized avatar

Seila NHIEP seilanhiep

  • Parliamentary Institute of Cambodia
  • Phnom Penh
View GitHub Profile
---
title: "Election map and graphic"
author: "NHIEP Seila"
date: "`r Sys.Date()`"
format:
html:
code-fold: true
toc: true
toc-title: TRUE
editor: visual
@seilanhiep
seilanhiep / Election-R2pdf-multi.r
Last active September 2, 2022 01:27
Interactive Map and Chart
---
title: "Election Visualization"
author: "Seila"
date: "5/15/2022"
#output: html_document
output: pdf_document
#output: word_document
---
##### Call Library ----
{
library(tidyverse)
library(tidyxl)
library(unpivotr)
library(readxl)
library(ggplot2)
library(plotly)
library(crosstalk)
library(bizdays)
---
title: "STT Demo"
date: "5/08/2021"
output:
flexdashboard::flex_dashboard:
orientation: rows
theme: flatly
storyboard: FALSE
#css: my-custom-rules.css
fig_mobile: TRUE
---
title: "PCAsia Work Plan 2021"
author: "NHIEP Seila"
output:
flexdashboard::flex_dashboard:
orientation: rows
theme: flatly
#“default”,“cerulean”,“journal”,“flatly”,“darkly”,“readable”,“spacelab”,“united”,“cosmo”,“lumen”,“paper”,“sandstone”,“simplex”,“yeti”
vertical_layout: fill
social: [ "menu" ]
---
title: "TimesheetPCAsia"
output:
flexdashboard::flex_dashboard:
orientation: rows
theme: flatly
storyboard: FALSE
#css: my-custom-rules.css
fig_mobile: TRUE
vertical_layout: fill
@seilanhiep
seilanhiep / UGCA.r
Last active September 2, 2022 01:29
library(raster)
openfile = "F:/Mommy/RDataThesis/FRUGMdata"
files <- dir(openfile, pattern="..tif$",full.names=TRUE, ignore.case = TRUE)
for (i in 1:(length(files))) {assign(substr(files[i],(nchar(openfile)+2),(nchar(files[i])-4)), raster(files[i]))}
print(ls())
# lf = list(AHP2000,AHP2009,road,ue1989,ue2000,ue2009,restrict)
# plot(lf[[4]])
###########################################
#######################################################
#plot(ugmf|road)
library(tidyr)
library(dplyr)
library(readxl)
##### Set Working Directory #####
setwd("F:/Rscript2020/data")
##### list the files in directory #####
emif = read_xlsx("Gear-and-distance.xlsx", sheet = 3)
####### Column name in text starting with 01 02 03 ... ###############
gf = emif %>% gather(categories, Numberofboat, "01km":"60km", na.rm = FALSE, convert = TRUE)
names(gf)
##### Call Library #####
library(rgdal)
library(raster)
##### Set Working Directory #####
setwd("F:/PICAtlas/Atlas 2016/Imagery/Sentinel 2019/IMGDATA")
##### list the files in directory #####
rnf = list.files()
##### Read JPEG2000 from drive #####
for (i in 1:(length(rnf))) {
# assign(scan("",what="char",skip=1,quiet=TRUE,nlines=1), raster(paste0(getwd(),"/",lc8f[i])))
@seilanhiep
seilanhiep / landsat87change.r
Last active May 10, 2020 13:03
Video of landsat 8 and 7 with their analysis
Gifvideo = function(dirlsat8,dirlsat7,odri,lsat8video,lsat8gif){
packages <- c( "RStoolbox", "raster", "caret", "randomForest", "e1071", "animation","rgdal")
lapply(packages, library, character.only = TRUE)
file8 = list.files(dirlsat8, pattern = "*MTL.txt$" , all.files= TRUE)
dirMTLfile8 <- paste0(dirlsat8,"/",file8)
metaData <- readMeta(dirMTLfile8, raw = TRUE)
lsat8 <- stackMeta(dirMTLfile8)