We will use the internal mtcars
dataset to illustrate.
dat <- mtcars
head(dat)
## First make up some mock data | |
my_data <- data.frame(date = seq(as.Date("2010-01-01"), as.Date("2015-12-31"), | |
by = "1 month"), | |
value = rnorm(72)) | |
## Remove some observations so we have an incomplete data set | |
my_incomplete_data <- my_data[sort(sample(nrow(my_data), 60)), ] | |
## Make a data frame with a full series of dates from the min date to the max date | |
## in the incomplete data frame |
library(dplyr) | |
## Make some mock data for illustration: | |
date_time <- seq(as.POSIXct("2014-01-01"), as.POSIXct("2015-08-18"), by = "1 hour") | |
value <- rnorm(length(date_time)) | |
my_data <- data.frame(date_time, value) | |
# Create a date column (remove time) | |
my_data$date <- as.Date(my_data$date_time, tz = "Canada/Pacific") |
find_matching_paren <- function(str, open_paren = "(") { | |
close_paren <- switch(open_paren, "(" = ")", "{" = "}", "[" = "]") | |
# Split string into single characters | |
str <- strsplit(str, "")[[1]] | |
## Find the first openening parenthesis in the string | |
start_pos <- grep(paste0("\\", open_paren), str)[1] + 1 | |
counter <- 1 |
library(rgdal) | |
poly <- '{ "type": "Polygon", | |
"coordinates": [ | |
[ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0] ] | |
] | |
}' | |
poly2 <- '{ "type": "FeatureCollection", | |
"features": [ |
## Make some mock data for demonstration purposes: | |
Species <- c("Green-winged Teal", "Bald Eagle", "Swainson's Hawk", "Red-tailed Hawk", | |
"American Coot", "Rock Pigeon", "Red-naped Sapsucker", "Northern Flicker", | |
"American Kestrel", "Western Wood-Pewee", "Willow Flycatcher", | |
"Dusky Flycatcher", "Say's Phoebe", "Eastern Kingbird", "Black-billed Magpie", | |
"Common Raven", "Tree Swallow", "Cliff Swallow", "House Wren", | |
"Marsh Wren", "Mountain Bluebird", "American Robin", "European Starling", | |
"Cedar Waxwing", "Yellow-rumped Warbler", "Clay-colored Sparrow", | |
"White-crowned Sparrow", "Vesper Sparrow", "Western Meadowlark", | |
"Yellow-headed Blackbird", "Brewer's Blackbird", "Mallard", "Blue-winged Teal", |
So, you've committed some changes to your repository that you want to roll back. This will tell you how to roll that back. It assumes that you want to pretend that the offending commit(s) never happened. Note that this workflow is the simplest solution, and works well for us because we are a small team that communicates well, but it is generally considered bad practice because it rewrites history and can mess up collaborators.
Find the commit that you want to roll back to, and copy the SHA (the unique alphanumeric string that identifies the commit).
In git bash, type:
git reset --hard theSHA
self_union <- function(x) { | |
stopifnot(requireNamespace("rgeos")) | |
n <- length(x) | |
if (n < 2) { | |
return(x) | |
} | |
if (.hasSlot(x, 'data')) { | |
x <- as(x, 'SpatialPolygons') |