Skip to content

Instantly share code, notes, and snippets.

View davan690's full-sized avatar
💭
I may be slow to respond.

Anthony R Davidson davan690

💭
I may be slow to respond.
View GitHub Profile
@davan690
davan690 / dynamictabs_template.R
Created March 17, 2022 22:23
Import script for Dynamic Tab notes
#git clone
## adding .RProj file
##
@davan690
davan690 / Update-branch.md
Created November 2, 2021 01:48 — forked from santisbon/Update-branch.md
Deploying from Git branches adds flexibility. Bring your feature branch up to date with master and deploy it to make sure everything works. If everything looks good the branch can be merged. Otherwise, you can deploy your master branch to return production to its stable state.

Updating a feature branch

First we'll update your local master branch. Go to your local project and check out the branch you want to merge into (your local master branch)

$ git checkout master

Fetch the remote, bringing the branches and their commits from the remote repository. You can use the -p, --prune option to delete any remote-tracking references that no longer exist in the remote. Commits to master will be stored in a local branch, remotes/origin/master

3D Regression Shiny App
Base R code created by Irvin Alcaraz
Shiny app files created by Irvin Alcaraz
Cal Poly Statistics Dept Shiny Series
http://statistics.calpoly.edu/shiny
@davan690
davan690 / hosting-on-github.md
Created September 11, 2020 03:20 — forked from TylerFisher/hosting-on-github.md
Basic steps for hosting on Github

Hey there, apparently people are still using this Gist from 2013! It's out of date! Consult the Github docs.

Steps for Hosting a Website on GitHub

  1. Create a GitHub account on github.com.
  2. Download either [GitHub for Mac][1] or [GitHub for Windows][2], depending on your operating system. Open the app and log in using the account you just created.
  3. (On Mac): After you login, click advanced and make sure that your name and email are correct. Then, click "Install Command Line Tools", just in case you want to start using the command line later in life.
  4. Create a new repository in your GitHub application. Name it your-username.github.io. The name is very important. Note the folder that GitHub is saving the repository to. Make sure the "Push to GitHub?" box is checked.
  5. Move your website's files into the folder that GitHub just created when you made the repository. IMPORTANT: Your homepage HTML file must be called "index.html", and it must exist in the top-level
@davan690
davan690 / source_here_scripts
Created September 8, 2020 23:29
Understanding files paths in Rstudio and R 4.0.1
# Make sure you have the project running through RStudio with a "project" file within the root directory.
#libraries
library(here)
library(tidyverse)
# 1. Place R scripts in folder within the root directory (project file location)
# 2. Source file from this location in RMD file
source("./R/Rscriptv1.R")

There are packages for this now!

2017-08-03: Since I wrote this in 2014, the universe, specifically Kirill Müller (https://github.com/krlmlr), has provided better solutions to this problem. I now recommend that you use one of these two packages:

  • rprojroot: This is the main package with functions to help you express paths in a way that will "just work" when developing interactively in an RStudio Project and when you render your file.
  • here: A lightweight wrapper around rprojroot that anticipates the most likely scenario: you want to write paths relative to the top-level directory, defined as an RStudio project or Git repo. TRY THIS FIRST.

I love these packages so much I wrote an ode to here.

I use these packages now instead of what I describe below. I'll leave this gist up for historical interest. 😆

@davan690
davan690 / _output_template.yml
Last active February 23, 2022 02:01
My Basic template for the _output file of a bookdown project. Additional files needed are within this gist in future (2022)
bookdown::gitbook:
css: style.css
config:
toc:
before: |
<li><a href="./">Book title.</a></li>
after: |
<li><a href="https://github.com/username/repo" target="blank">Published with bookdown</a></li>
edit: https://github.com/username/repo/docs/edit/master/%s
download: ["pdf", "epub", "mobi", "docx"]
@davan690
davan690 / IndexNewBook.Rmd
Last active February 23, 2022 02:07
My simple bookdown project build files
---
title: "Book title"
site: bookdown::bookdown_site
output: bookdown::gitbook
#github-repo: username/repo
subtitle: "Sub info"
# bibliography: ["references.bib", "book.bib"]
---
# Summary {#summary}
t-test Shiny App
Base R code created by Jimmy Wong
Shiny app files created by Jimmy Wong
Cal Poly Statistics Dept Shiny Series
http://statistics.calpoly.edu/shiny
@davan690
davan690 / countries_codes_and_coordinates.csv
Created April 2, 2020 09:05 — forked from tadast/countries_codes_and_coordinates.csv
Countries with their (ISO 3166-1) Alpha-2 code, Alpha-3 code, UN M49, average latitude and longitude
Country Alpha-2 code Alpha-3 code Numeric code Latitude (average) Longitude (average)
Afghanistan AF AFG 4 33 65
Albania AL ALB 8 41 20
Algeria DZ DZA 12 28 3
American Samoa AS ASM 16 -14.3333 -170
Andorra AD AND 20 42.5 1.6
Angola AO AGO 24 -12.5 18.5
Anguilla AI AIA 660 18.25 -63.1667
Antarctica AQ ATA 10 -90 0
Antigua and Barbuda AG ATG 28 17.05 -61.8