Skip to content

Instantly share code, notes, and snippets.

@ijlyttle
ijlyttle / install_RMySQL.md
Last active February 5, 2022 10:04
how to install RMySQL

Keep in mind this page (http://biostat.mc.vanderbilt.edu/wiki/Main/RMySQL)

Windows 7

Install MySQL Community Server from (http://dev.mysql.com/downloads/mysql/)

Then (from StackOverflow)

  • Go to System->Advanced->Enviroment Variables, press New and Enter Variable name as MYSQL_HOME and Variable values as C:/PROGRA~1/MYSQL/MYSQLS~1.6, and notice that it is / not \. This is a bit different from the StackOverflow answer - the trick is to use the Windows shortname. Open a command window, go to your MySQL directory, and type dir /x to get the correct particular ending. From R, confirm by typing Sys.getenv("MYSQL_HOME").
@ijlyttle
ijlyttle / thoughts.md
Last active August 29, 2015 14:03
Shiny and rmarkdown

The goal is to be able to reproduce a website like "adv-r.had.co.nz", writing the content using rmd files, and to be able to embed (and serve) shiny content.

The way suggested by RStudio, in their rmarkdown documentation, is that the author provides an Rmd document to shiny-server, and it renders the entire document (including shiny) whenever the user demands it. In essence, shiny-server takes over the job that jekyll does for "adv-r.had.co.nz".

I have some questions about performance, caching strategies, and the like - but those will wait until I understand better the process.

There are formatting options; the author can create a template and tell shiny-server to use it when compiling. Looking again at the documentation, it seems that the tempate functions are defined in a package, then each Rmd file invokes the package and the template function in the output: bit of yaml. The tem

@ijlyttle
ijlyttle / howto.md
Created July 9, 2014 20:51
How to install R packages on Ubuntu

The challenge seems to be how to install R packages to the site library, rather than to the user's local library.

The R command .libPaths() is instructive here.

What I do is invoke R from the command line using sudo -i R. Apparently, this calls R as "root".

From R, calling .libPaths() confirms that my local directory is not there.

Then, I can use install_github or install.packages and it goes to the right place.

@ijlyttle
ijlyttle / example.Rmd
Created July 11, 2014 17:17
RMarkdown: reveal.js slide hierarchy
---
title: "Reveal test"
output:
revealjs_presentation:
pandoc_args: [ "--slide-level", "2" ]
---
## Slide 1
This is a slide
@ijlyttle
ijlyttle / vega_url_transitions.html
Last active August 29, 2015 14:03
Vega URL Transitions
<!DOCTYPE html>
<html>
<head>
<script src="https://trifacta.github.io/vega/lib/d3.v3.min.js"></script>
<script src="https://trifacta.github.io/vega/vega.js"></script>
</head>
<body>
<script type="text/javascript">
var url_spec = {
@ijlyttle
ijlyttle / shiny_embedded_widgets.Rmd
Created July 21, 2014 00:03
Reproducible example (perhaps not minimal) on shiny and rmarkdown
---
title: Nested Widgets
runtime: shiny
output: html_document
---
## Introduction
I seem to be able to something really cool using shiny, interactively, on my computer, but I cannot get it to work using shiny within an rmarkdown document run from shiny.
@ijlyttle
ijlyttle / file_update_reactive.R
Created July 25, 2014 17:39
idea to keep status on if data are ready in shiny
library(shiny)
shinyApp(
ui = wellPanel(
actionButton(
"file",
label = "file upload"
),
actionButton(
@ijlyttle
ijlyttle / sessionInfo.txt
Last active August 29, 2015 14:04
Issues with ggvis, shiny, and rmarkdown
> sessionInfo()
R version 3.1.0 (2014-04-10)
Platform: x86_64-apple-darwin13.1.0 (64-bit)
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
@ijlyttle
ijlyttle / subApp_data_path.Rmd
Created August 1, 2014 13:26
subApp cannot find data directory
---
title: "SubApp path to data"
author: "Ian Lyttle"
runtime: shiny
output:
html_document:
theme: united
---
This is a case where a subApp behaves differently from an app.
@ijlyttle
ijlyttle / modalButton.R
Last active January 13, 2016 18:49
Modal button for shiny
library(shiny)
#' modalButton
#'
#' Creates a modal dialog box. \code{header} and \code{content} can
#' include shiny inputs and outputs.
#'
#' @param inputId Specifies the input slot that will be used to access the value.
#' @param label The contents of the button or link–usually a text label, but you could also use any other HTML, like an image.
#' @param icon An optional icon to appear on the button.