library(ggplot2)
iris$is_pretty <- sample(c(TRUE, FALSE), nrow(iris), replace = TRUE)
# dodge < width
ggplot(iris, aes(y = is_pretty, x = Petal.Length, fill = Species)) +
geom_bar(stat = "identity", position = position_dodge(0.5), width = 0.85)
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
| *.png | |
| .DS_Store | |
| .Rhistory |
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
| # install.packages(c("bcdata", "dplyr", "remotes")) | |
| # remotes::install_github("bcgov/rems") | |
| library(rems) | |
| library(bcdata) | |
| library(dplyr) | |
| # Get the watershed boundary - I don't know if this is exactly the boundary you | |
| # want but you could read in any spatial file you have instead using the sf package. Eg: | |
| # columbia <- sf::read_sf("path-to-my-columbia-boundary.shp") | |
| columbia <- bcdc_query_geodata("eaubc-freshwater-ecoregions") %>% |
library(sf)
#> Linking to GEOS 3.7.2, GDAL 2.4.2, PROJ 5.2.0
system("ogr2ogr --version", intern = TRUE)
#> [1] "GDAL 2.4.2, released 2019/06/28"
system("proj", intern = TRUE)
#> character(0)
file <- system.file("gpkg/tl.gpkg", package = "sf")locations <- data.frame(id = "E309447")
library(rems)
library(dplyr)
hist_db <- attach_historic_data()
filtered_historic <- hist_db %>%
filter(EMS_ID %in% locations$id) %>%
collect()
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
| # If you haven't installed homebrew, see some instructions here: | |
| # https://github.com/bcgov/envreportutils/wiki/Macbook-Pro-Setup-for-Data-Science-at-EnvReportBC#homebrew | |
| # These have not been tested on macOS Catalina, but the Mojave instructions _should_ work. | |
| # If you run into issues, this looks like it might be helpful: | |
| # https://medium.com/faun/macos-catalina-xcode-homebrew-gems-developer-headaches-cf7b1edf10b7 | |
| # The osgeo homebrew tap is in a bit of a mess, so `brew install saga-gis` doesn't work (as of 2019-10-30). | |
| # This is because SAGA dependencies have been updated, but they haven't updated the brew formula for SAGA itself. | |
| # Same goes for QGIS; and now that there is a fully self-contained signed installer, I recommend that over heomebrew for QGIS | |
| # (https://qgis.org/en/site/forusers/download.html) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
| ## | |
| # osgeo/gdal:ubuntu-full | |
| # This file is available at the option of the licensee under: | |
| # Public domain | |
| # or licensed under X/MIT (LICENSE.TXT) Copyright 2019 Even Rouault <[email protected]> | |
| # ACT: Copied from https://raw.githubusercontent.com/OSGeo/gdal/master/gdal/docker/ubuntu-full/Dockerfile | |
| ARG PROJ_INSTALL_PREFIX=/usr/local |
values <- runif(100)
# get runs where values > 0.75 (these are TRUE/FALSE)
runs <- rle(values > 0.75)
# Mask out the runs with lengths < 3
runs$values[runs$lengths < 3] <- FALSE
# Get a vector of positions that meet the run criteria
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
| values <- runif(100) | |
| # get runs where values > 0.75 (these are TRUE/FALSE) | |
| runs <- rle(values > 0.75) | |
| # Mask out the runs with lengths < 3 | |
| runs$values[runs$lengths < 3] <- FALSE | |
| # Get a vector of positions that meet the run criteria | |
| masked <- inverse.rle(runs) |
