Skip to content

Instantly share code, notes, and snippets.

View daattali's full-sized avatar

Dean Attali daattali

View GitHub Profile
Dean Attali
=================================
**STAT 545A hw 3**
**Sept 22 2013**
Exercises done:
* Average GDP/cap in each continent when the data was first and last collected **(easy)**
* Trimmed mean statistics for life expectancy in each continent for every year **(fun)**
* Absolute and relative world population in each of the continents **(very fun)**
* A list of all countries that at some point had their population size decrease **(very fun)**
Dean Attali
=================================
**STAT 545A hw 3**
**Sept 22 2013**
Exercises done:
* Average GDP/cap in each continent when the data was first and last collected **(easy)**
* Trimmed mean statistics for life expectancy in each continent for every year **(fun)**
* Absolute and relative world population in each of the continents **(very fun)**
* A list of all countries that at some point had their population size decrease **(very fun)**
```{r include = FALSE}
opts_chunk$set(tidy = FALSE)
```
Dean Attali
=================================
**STAT 545A hw 4**
**Sept 28 2013**
In this assignment, I will take data aggregation code written by other students, and create visuals that will complement their tabular data. The two students' work I will be using are [**Rebecca Johnston**](http://rpubs.com/rljohn/stat545a-2013-hw03_johnston-reb) and [**Daniel Dinsdale**](http://rpubs.com/danieldinsdale/stat545a-2013-hw03_dinsdale-dan).
```{r include = FALSE}
opts_chunk$set(tidy = FALSE)
```
Terrorism in Israel
===========================
**Dean Attali**
**Oct 4, 2013**
**STAT 545A**
@daattali
daattali / 01_colourInput.R
Last active February 1, 2016 00:16
Little shiny apps used in my shinyjs tutorial http://bit.ly/shinyjs-slides
# See http://daattali.com/shiny/colourInput/ for more demos
library(shiny)
library(shinyjs)
ui <- fluidPage(
useShinyjs(),
colourInput("col", "Colour", "blue")
# colourInput("col", "Colour", "#ff0000",
# palette = "limited", showColour = "background")
@daattali
daattali / closest_colour.R
Last active March 7, 2016 12:53
Find the R built-in colour that's closest in RGB space to a given colour
# Find the R built-in colour that's closest in RGB space to a given colour
# This can be useful if you have a colour in mind you want to use in your R
# code, but would rather use a pretty built-in name rather than a HEX value.
#
# @param target The target RGB colour, given as a length-3 numeric vector
# @param n The number of top hits to return
# @param superset A vector with all possible colour names to choose from
#
# Note that the closest colour in RGB space is not guaranteed to be the
# closest colour visually, but it works in many cases.
@daattali
daattali / code-and-text-combo.R
Created September 29, 2016 09:57
An attempt to have a way to create the code for an output only once, and be able to both display it and its code
# Disclaimer: I'm a noob at NSE and this implementation is just something I whipped up in 5 minutes at 3am.
# So if it's terrible, no judging!
library(shiny)
library(ggplot2)
ui <- fluidPage(
colourpicker::colourInput("col", "Select colour", "red"),
plotOutput("plot"),
verbatimTextOutput("code")
@daattali
daattali / shiny-bootstrap-tagsinput.R
Last active May 5, 2017 23:43
Extremely basic bootstrap tagsinput wrapper in shiny
# http://bootstrap-tagsinput.github.io/bootstrap-tagsinput/examples/
library(shiny)
tagsinput <- function(tag) {
tag$children[[2]] <- tagAppendAttributes(tag$children[[2]],
`data-role` = "tagsinput")
tag
}
@daattali
daattali / selectize-tags.R
Created May 6, 2017 19:20
Turn selectize input into a tags input
# This can be improved in a few ways easily:
# - make this into a function so you don't need to know all the parameters
# - use CSS to not show the dropdown that keeps popping up to "add" each item
library(shiny)
ui <- fluidPage(
selectizeInput("select", "Select", c(),
multiple = TRUE, options = list(
'create' = TRUE,
'persist' = FALSE)
@daattali
daattali / reactive_time.R
Created May 13, 2017 20:13
Update the time in a tab every time the tab opens
library(shiny)
ui <- fluidPage(
tabsetPanel(
id = "maintabs",
tabPanel(
"tab1",
"Current time is",
textOutput("time_out", inline = TRUE)
),