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(httr) | |
url <- "https://anrweb.vermont.gov/dec/_dec/LongTermMonitoringLakes.aspx" | |
html_session(url) %>% | |
html_form() | |
html_session(url) %>% | |
html_nodes() |
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
import time | |
start = time.clock() | |
import sys, os | |
import arcpy | |
arcpy.CheckOutExtension("Spatial") | |
import rpy2.robjects as robjects | |
import math | |
r=robjects.r | |
r("library(rgdal)") | |
#These options can be set to desired workspace and names of input elevation, catchment, and lake datasets |
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(LAGOSNEgis) # devtools::install_github("cont-limno/LAGOSNEgis") | |
library(ggplot2) | |
library(dplyr) | |
library(sf) | |
# st_layers(lagosnegis_path()) | |
# gdalUtils::ogrinfo(lagosnegis_path(), "Stream_Polylines", so = TRUE) | |
state <- query_gis("STATE", "State_Name", "New York") | |
lakes <- query_gis_(query = "SELECT * FROM LAGOS_NE_All_Lakes_4ha WHERE STATE LIKE 'NY' AND Lake_Area_Ha > 1600") |
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(desc) | |
library(stringr) | |
full_citation <- function(pkg, year){ | |
# pkg <- "rnoaa" | |
# year <- 2019 | |
file <- system.file("DESCRIPTION", package = pkg) | |
dt <- desc::desc(package = pkg) | |
aut <- dt$get_authors() |
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(gistr) | |
data(iris) | |
dt <- iris | |
str <- '' | |
tc <- textConnection('str', 'w', local = TRUE) | |
write.csv(dt, file = tc, row.names = FALSE) | |
close(tc) |
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(ggplot2) | |
library(dplyr) | |
x <- 1:30 | |
y <- log(x) | |
xi <- sample(x, 6) | |
xi <- xi[order(xi)] | |
fxi <- log(xi) |
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
#' Download files from Zenodo record id | |
#' | |
#' @param record_id record id | |
#' @param dest_folder destination folder for file downloads | |
#' @param token API key | |
#' | |
#' @details https://github.com/zenodo/zenodo/issues/1629#issuecomment-435062462 | |
#' | |
#' @importFrom httr GET content | |
#' @importFrom jsonlite fromJSON |
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
# Kreft, I.G. and De Leeuw, J., 1998. Introducing multilevel modeling. Sage. | |
library(CMatching) | |
library(dplyr) | |
library(purrr) | |
library(tidyr) | |
library(broom) | |
library(ggplot2) | |
data("schools") |
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(progress) | |
f <- function(i){ | |
pb$tick(tokens = list(status = "pulling data ", iter = i)) | |
Sys.sleep(0.4) | |
pb$tick(tokens = list(status = "running calculations", iter = i)) | |
Sys.sleep(0.7) | |
} |
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(LAGOSNE) | |
library(mapview) | |
llid <- 1867 | |
coords <- lake_info(llid) | |
mapview(coordinatize(coords)) |