{{ message }}

Instantly share code, notes, and snippets.

# Colin Gillespie csgillespie

Created Feb 16, 2016
RANDU: the bad random number generator
View RANDU.R
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
 N = 1000 randu = matrix(0, ncol=3, nrow=N) ##Simulate from the randu random number generator new_z = 1 for(i in 1:N) { new_x = (65539*new_z) %% 2^31 new_y = (65539*new_x) %% 2^31 new_z = (65539*new_y) %% 2^31 randu[i,] = c(x=new_x/2^31, y=new_y/2^31, z=new_z/2^31)
Last active Mar 23, 2021
Getting the most out of Git

# Getting the most out of Git

This GitHub gist contains instructions for the R, git & travis tutorial.

## Assumed knowledge

Partipants must be familar with

Last active Aug 19, 2020
Prerequisites for ODSC
View odsc-pre-req.md

# R for Python Programmers

This course is suitable for anyone with a some previous background in programming (not necessarily Python).

## Software

### R

Please make sure you a using a recent version of R (at least 3.6.X) - the final digit is the minor version number. The essential numbers are the first two.

Last active Apr 11, 2020
Exploring R graphics
View graphics.R
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
 # Used in the blog post # https://www.jumpingrivers.com/blog/r-graphics-cairo-png-pdf-saving/ library(ggplot2) library(extrafont) library(ragg) library(Cairo) extrafont::loadfonts() set.seed(1)
Last active Apr 9, 2020
Pre-requisites for ODSC
View odsc-east.md
title output
Tidyverse prerequisites (ODSC)
html_notebook

## Software

Please make sure you a using a recent version of R (at least 3.4.X) - the final digit is the minor version number. The essential numbers are the first two. You can check the version of R you are running via

Last active Oct 31, 2019
Foundational data science with R
View foundational-data-science.md

## Software

Please make sure you are using a recent version of R (current version is 3.6.X) - the final digit is the minor version number. The essential numbers are the first two. You can check the version of R you are running via

``````R.version.string
``````

Last active Apr 9, 2019
View satRday.R
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
 library("rtweet") library("tidyverse") # Don't judge me! # Why is this not in tidyverse # Can we start a petition? library("lubridate") # Notice the superior use of "=" over "<-" get_tweets = function(q, n = 1000, include_rts = TRUE) { search_tweets(q = q, n = n,
Created Oct 27, 2017
Slow down
View toeplitz.R
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
 ##R version 3.4.2 (2017-09-28) ##Platform: x86_64-pc-linux-gnu (64-bit) ##Running under: Ubuntu 16.04.3 LTS bm_prog_toeplitz = function() { N = 3000 ans = rep(0, N*N) dim(ans) = c(N, N) system.time({ for (j in 1:N) {
Last active Oct 11, 2017
odsc
View Setup.md

## Overview

This session will be a mixture of lectures and short practical sessions using R.

## Software

Please make sure you are using the latest version of R (current version is 3.4.1) - the final digit is the minor version number. The essential numbers are the first two. You can check the version of R you are running via

Created Sep 29, 2017
Comparison of plotly and gpglotly
View compare.R
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
 library(plotly) library(reshape2) compare_func_time = function(number = 1, N = 5000){ df = data.frame(matrix(nrow = N, ncol = 11, data = c(rnorm(10*N,10), rnorm(N,30,10)))) colnames(df) = paste0("dist", 1:11) st1 = system.time({ replicate(number, { l = list()