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
# Load library | |
library(XML) | |
# ----------------------- | |
# Read the web page | |
# ----------------------- | |
link <- "http://www.adirondacklakessurvey.org/alscrpt.inc.php?alscpond=020225B&pname=ALLEGANY%20BROOK%20POND" | |
# NOTE: is ethical to store the page and not read it unnecessarily too many times, | |
# overloading their server | |
link.scrap <- htmlParse(link) |
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
# Load library | |
library(rvest) | |
# ----------------------- | |
# Read the web page | |
# ----------------------- | |
link <- "http://www.adirondacklakessurvey.org/alscrpt.inc.php?alscpond=020225B&pname=ALLEGANY%20BROOK%20POND" | |
# NOTE: is ethical to store the page and not read it unnecessarily too many times, | |
# overloading their server | |
link.scrap <- read_html(link) |
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
# ================================ | |
# helper script for species counts (lakes for Leana) | |
# ================================ | |
library(data.table) | |
# read data | |
lake_data <- fread("links_extract_dt.csv") | |
# count unique species by combination of `Pond Name`, Town, County | |
# skip or add column in the "by" section if needed |
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
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
# Script to read list of lake links and parse through them | |
# for Leana | |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
library(XML) | |
library(stringr) | |
library(data.table) | |
##################################################### | |
##################################################### |
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
# ========================================================================== | |
# Example of plot for publication with inwards ticks in ggplot | |
# ========================================================================== | |
library(ggplot2) | |
# ================================== | |
# create some data | |
# ================================== | |
set.seed(1) |
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
# ========================================================================== | |
# Example of plot for publication in base R with inwards ticks | |
# ========================================================================== | |
# ================================== | |
# create some data | |
# ================================== | |
set.seed(1) | |
DF <- data.frame(year = c(2000:2020), | |
mean = rnorm(n=21, mean=100, sd=10)) |
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
# ========================================================================== | |
# Dotplot with CI/error bars for publication - ggplot | |
# see also: http://www.cookbook-r.com/Graphs/Plotting_means_and_error_bars_(ggplot2)/ | |
# ========================================================================== | |
library(ggplot2) | |
# ================================== | |
# create some data | |
# ================================== |
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
# ========================================================================== | |
# Barplot with CI/error bars for publication - ggplot | |
# see more at: http://www.cookbook-r.com/Graphs/Plotting_means_and_error_bars_(ggplot2)/ | |
# ========================================================================== | |
library(ggplot2) | |
# ================================== | |
# create some data | |
# ================================== |
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
# ====================================================================================== | |
# Color case. | |
# Confidence bands and setting order of line types in legend based on group - ggplot. | |
# The lower and upper values could be computed through bootstrapping. | |
# ====================================================================================== | |
library(ggplot2) | |
# create some data | |
x=seq(from=0, to=2*pi, by=0.1) |
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
# ====================================================================================== | |
# Color case. | |
# Confidence lines and setting order of line types in legend based on group - ggplot. | |
# ====================================================================================== | |
library(ggplot2) | |
# create some data | |
x=seq(from=0, to=2*pi, by=0.1) | |
my.data <- data.frame(x = rep(x,2), |