Skip to content

Instantly share code, notes, and snippets.

@mrjoh3
mrjoh3 / dashboard_test.rmd
Created June 23, 2016 21:12
Testing dynamic resize within flexdashboard
---
title: "Testing Pier Resize"
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: fill
horizontal_layout: fill
---
```{r setup, include=FALSE}
@mrjoh3
mrjoh3 / dashboard_widget_size.Rmd
Created June 25, 2016 07:55
Test widget resize in flexdashboard pages
---
title: "Widget Size Test"
output:
flexdashboard::flex_dashboard
---
```{r setup, include=FALSE}
#devtools::install_github("mrjoh3/c3")
@mrjoh3
mrjoh3 / nova_sensor_influxdb.y
Last active April 9, 2017 03:04
Read particle data from a Nova sensor and save to InfluxDB
import time
import serial, re, os
from datetime import datetime
from time import strftime
from influxdb import InfluxDBClient
import geohash
# Set this variables, influxDB should be localhost on Pi
host = "localhost"
port = 8086
# script for running sharp GP2Y1010AU using micropython ESP32 controller
import machine, time
ao = machine.ADC(machine.Pin(36)) # analog read
led = machine.Pin(39) # this is not working
#led = machine.Pin(15, machine.Pin.OUT)
#mg/m3 but want ug/m3
def get_dust():
@mrjoh3
mrjoh3 / alcohol_accidents.R
Created July 18, 2018 12:42
Animation of alcohol related related road accidents in Victoria Australia 2012 - 2017
library(dplyr)
library(sf)
library(ggplot2)
library(gganimate)
shp <- st_read('shp','Crashes_Last_Five_Years') %>%
filter(ALCOHOL_RE == 'Yes') %>%
mutate(date = as.Date(as.character(ACCIDENT_D), '%d/%m/%Y'))
vic <- st_read('shp', 'VIC_STATE_POLYGON_shp')
@mrjoh3
mrjoh3 / coiled_rainbow.R
Created August 27, 2018 07:35
Animated Harmonograph
library(dplyr)
library(purrr)
library(ggplot2)
library(gganimate)
# setup variables
A1 <- 0
A2 <- 1
A3 <- 0
A4 <- 2
@echo on
:: Render Rmd reports
"C:\Program Files\R\R-3.4.0\bin\x64\Rcmd.exe" BATCH "C:\REPORTS\run_reports.R
:: Mount SHAREPOINT document library as directory r:
net use r: http://sp13intranet/.../web
:: Copy all files to SHAREPOINT folder .../web/REPORTS
xcopy C:\REPORTS\* r:\REPORTS\* /D /E /C /H /R /Y /K /I /S /G
@mrjoh3
mrjoh3 / industrial_estates.Rmd
Last active November 1, 2018 21:46
Copy of Rmd used in Radix blog
---
title: "Industry Area"
description: "industrial estates"
author:
- name: Jane Doe
url: http://localhost:9999/index.html
date: August 10 2018
client:
- 'John Doe'
categories:
@mrjoh3
mrjoh3 / rmd_formats_webshot.Rmd
Created November 3, 2018 03:10
Webshot will automatically render web content for non-web formats such as PDF
---
title: "Untitled"
output:
rmarkdown::github_document:
html_preview: true
html_document: default
pdf_document: default
always_allow_html: yes
---
@mrjoh3
mrjoh3 / colour_corona_map.R
Last active March 31, 2020 12:18
Simple COVID-19 map demonstrating sequential colour scale
# load required packages
library(sf)
library(foreign)
library(dplyr)
library(ggplot2)
# COVID-19 data source
# 31 Mar 2020 https://app.powerbi.com/view?r=eyJrIjoiODBmMmE3NWQtZWNlNC00OWRkLTk1NjYtMjM2YTY1MjI2NzdjIiwidCI6ImMwZTA2MDFmLTBmYWMtNDQ5Yy05Yzg4LWExMDRjNGViOWYyOCJ9
cov <- tibble::tribble( ~ LGA_NAME, ~ Cases,
"ALPINE SHIRE", 0,