This file contains hidden or 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
Type | Subtype | Country | Name | Alcohol_Content | Price | Sweetness | |
---|---|---|---|---|---|---|---|
WINE | TABLE WINE RED | CANADA | COPPER MOON - MALBEC | 14 | 30.99 | 0 | |
WINE | TABLE WINE WHITE | CANADA | DOMAINE D'OR - DRY | 11.5 | 32.99 | 0 | |
WINE | TABLE WINE RED | CANADA | SOMMET ROUGE | 12 | 29.99 | 0 | |
WINE | TABLE WINE WHITE | CANADA | MISSION RIDGE - PREMIUM DRY WHITE | 11 | 33.99 | 1 | |
WINE | TABLE WINE RED | UNITED STATES OF AMERICA | ZINFANDEL - BIG HOUSE CARDINAL ZIN | 13.5 | 36.99 | 0 | |
WINE | TABLE WINE RED | FRANCE | LE VILLAGEOIS RED - CELLIERS LA SALLE | 11 | 34.99 | 0 | |
WINE | TABLE WINE RED | CANADA | SAWMILL CREEK - MERLOT | 12.5 | 119 | 0 | |
WINE | TABLE WINE WHITE | CANADA | SOLA | 12 | 32.99 | 0 | |
WINE | TABLE WINE WHITE | CANADA | GANTON & LARSEN PROSPECT - PINOT BLANC BIRCH CANOE 2011 | 11.5 | 13.99 | 0 |
This file contains hidden or 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
#' Suppress all output from an expression. Works cross-platform. | |
#' @param expr Expression to run. | |
#' @param all If \code{TRUE} then suppress warnings and messages as well; | |
#' otherwise, only suppress printed output (such as from \code{print} or | |
#' \code{cat}). | |
#' @keywords internal | |
#' @export | |
quiet <- function(expr, all = TRUE) { | |
if (Sys.info()['sysname'] == "Windows") { | |
file <- "NUL" |
This file contains hidden or 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(shiny) | |
# Define the fields we want to save from the form | |
fields <- c("name", "used_shiny", "r_num_years") | |
# Save a response | |
# ---- This is one of the two functions we will change for every storage type ---- | |
saveData <- function(data) { | |
data <- as.data.frame(t(data)) | |
if (exists("responses")) { |
This file contains hidden or 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
# Suppose a function has an argument "x". If a "child function" has multiple | |
# argument beginning with "x" and I want to pass the param "x" to its parent, | |
# I get error: `argument n matches multiple formal arguments` | |
# The reason this happens is clear, but at 3am my brain is firing blanks | |
# trying to find a solution. Help! | |
library(magrittr) | |
foo <- function(x, ...) UseMethod("foo") | |
foo.parent <- function(x, n = 5, ...) n |
This file contains hidden or 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
# rasmusab/beepr package is great for telling you when your R code finishes running. | |
# But if the code throws an error, the beep will never come, and you won't know that | |
# it finished running until you visually check. | |
# Solution: change the error handler to a failure beep. | |
# Example | |
foo <- function(success = TRUE) { | |
if (!success) { | |
stop("Error!") | |
} |
This file contains hidden or 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
# There are two humans: `human` and `angry_human`. They only differ in the fact | |
# that angry humans have a frown on their face. | |
# Example code: | |
# dean <- human("Dean") | |
# ex <- angry_human("Ex") | |
# plot(dean) | |
# plot(ex) | |
# When plotting `dean`, RStudio shows me all the available parameters. |
This file contains hidden or 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
# 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. |
This file contains hidden or 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
#+ spinme-chunk, eval = FALSE, echo = FALSE | |
.scriptName <- basename(sys.frame(1)$ofile) | |
.spinOutput <- knitr::spin(.scriptName, knit = TRUE) | |
stop(sprintf("Ignore this error - your output is ready at:\n%s", | |
normalizePath(.spinOutput)), | |
call. = FALSE) | |
#+ spinme-done, eval = TRUE, echo = TRUE |
This file contains hidden or 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 include = FALSE} | |
opts_chunk$set(tidy = FALSE) | |
``` | |
Terrorism in Israel | |
=========================== | |
**Dean Attali** | |
**Oct 4, 2013** | |
**STAT 545A** |
This file contains hidden or 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 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). |