git branch -m master main
git push -u origin main
git push origin --delete master
But...you can do this as an Rmd with the git commands in a bash chunk
# modified from / inspired by @GShotwell | |
# gist: https://gist.github.com/GShotwell/b19ef520b6d56f61a830fabb3454965b | |
df <- tibble( | |
value = rnorm(100, 50, 10), | |
date = seq.Date(from = ymd("2022-01-01"), | |
ymd("2022-04-10"), | |
by = "day")) | |
# OBJECTIVE: | |
# * latitude and longitude stored with degrees with degree symbol and minutes with decimal | |
# * separate into two columns for each, with degrees and minutes separated | |
# step 1 - create a test tibble called "geo_loc" | |
geo_loc <- tribble( ~ latitude, ~ longitude, | |
"48º 4.206", "124º 45.553", | |
"46º 59.4942", "124º 12.6362") | |
# --- | |
# step 2 - split into degrees and minutes columns |
# {dplyr}'s `ungroup()` function | |
```{r} | |
# packages | |
library(gapminder) | |
library(dplyr) | |
``` | |
In this example, we calculate the difference in a country's life expectancy from the continent's mean life expectancy | |
- for example, the difference between life expectancy in Canada and the mean life expectancy of countries in the Americas |
penguins <- palmerpenguins::penguins | |
penguins %>% | |
filter(!is.na(sex)) %>% | |
mutate(bm_quart = gtools::quantcut(body_mass_g, q=4)) | |
penguins_2 <- penguins %>% | |
filter(!is.na(sex)) %>% | |
select(species, sex, body_mass_g) %>% | |
# mutate(bm_quart = gtools::quantcut(body_mass_g, q=4)) |
--- | |
title: "rename github repo" | |
author: "Martin Monkman" | |
date: "2020/10/05" | |
output: html_document | |
--- | |
From | |
https://www.r-bloggers.com/2020/07/5-steps-to-change-github-default-branch-from-master-to-main/ |
# short script to install the {annotater} package | |
# reference: https://github.com/luisDVA/annotater | |
# Step 1: install the {remotes} package | |
install.packages("remotes") | |
# Step 2: install {annotater} from the GitHub source | |
remotes::install_github("luisDVA/annotater") | |
# dplyr::case_when to find and clean FSA | |
# | |
# Notes: | |
# * FSA = "Forward Sortation Area" in Canadian postal parlance | |
# * the regex finds British Columbia FSAs (starting with "V") | |
FSA_list <- df %>% | |
mutate(FSA_clean = case_when( | |
str_detect(FSA, "V\\d.$") == TRUE ~ FSA, | |
TRUE ~ NA_character_ |
--- | |
title: "geom_col vs geom_bar" | |
author: "Martin Monkman" | |
date: "2020/04/19" | |
output: html_document | |
--- | |
```{r setup, include=FALSE} | |
knitr::opts_chunk$set(echo = TRUE) |
--- | |
title: "Transform Data" | |
subtitle: "hands-on examples, with answers" | |
output: html_notebook | |
--- | |
<!-- This file by Charlotte Wickham (with some modifications by Martin Monkman) is licensed under a Creative Commons Attribution 4.0 International License, adapted from the orignal work at https://github.com/rstudio/master-the-tidyverse by RStudio and https://github.com/cwickham/data-science-in-tidyverse-solutions. --> | |
```{r setup} | |
library(tidyverse) |