In the shell:
git clone https://github.com/hadley/adv-r.git
gem install jekyll mime-types
In R:
```{r global_options, include=FALSE, cache=FALSE} | |
library(knitr) | |
# Set basic options. You usually do not want your code, messages, warnings etc. | |
# to show in your actual manuscript however for the first run or two these will | |
# be set on. | |
opts_chunk$set(echo=FALSE, | |
warning=FALSE, | |
message=FALSE, | |
cache = TRUE, | |
include = FALSE, |
In the shell:
git clone https://github.com/hadley/adv-r.git
gem install jekyll mime-types
In R:
The attached code file provides an easy basic interface to the Wolfram Alpha API. Inspired by the wolframalpha module available for Python.
source("wa_lib.R")
https://twitter.com/fgilardi/status/573873339682418689/photo/1
to_char_bars <- function(input){
What if a function in a package has no examples? Or is poorly exampled? Wouldn't it be nice to find functioning instances of it "in the wild"?
Via Twitter, Noam Ross taught me a clever way to do such searches on GitHub. Put this into the GitHub search box to see people using the llply()
function from plyr
:
"llply" user:cran language:R
Or just click here.
# install.packages("plotGoogleMaps") | |
# install.packages("jsonlite") | |
# install.packages("rgdal") | |
library(jsonlite) | |
library(rgdal) | |
library(plotGoogleMaps) | |
readOGR(dsn = "http://146.148.79.138/sets/Cyprus.json?q=african&response=geo-record&rows=10000", layer = "OGRGeoJSON") -> oa.json | |
m1<-plotGoogleMaps(oa.json,zcol = "early.bce.ce", filename="oa.html") |
I think the two most important messages that people can get from a short course are:
a) the material is important and worthwhile to learn (even if it's challenging), and b) it's possible to learn it!
For those reasons, I usually start by diving as quickly as possible into visualisation. I think it's a bad idea to start by explicitly teaching programming concepts (like data structures), because the pay off isn't obvious. If you start with visualisation, the pay off is really obvious and people are more motivated to push past any initial teething problems. In stat405, I used to start with some very basic templates that got people up and running with scatterplots and histograms - they wouldn't necessary understand the code, but they'd know which bits could be varied for different effects.
Apart from visualisation, I think the two most important topics to cover are tidy data (i.e. http://www.jstatsoft.org/v59/i10/ + tidyr) and data manipulation (dplyr). These are both important for when people go off and apply
# By Ben Marwick, from: https://gist.github.com/benmarwick/11204658 with modifications by S. Graham | |
Short instructions to setup a Lubuntu Virtual Machine with | |
R & RStudio: | |
1. Download these: | |
http://lubuntu.net/ (Intel x86 desktop cd) | |
https://www.virtualbox.org/wiki/Downloads (Oracle VM VirtualBox) | |
2. Install Oracle VM VirtualBox, open it (if using windows, |
# Install devtools if needed | |
if(!require(devtools)) install.packages("devtools") |
As far as I know Rstudio does not count words or characters at the moment, which would be useful particularly when writing Rmarkdown.
This is a quick shortcut using word_count
and character_count
functions from qdap
package. See below for two wrapper functions that simplify their use.
library("qdap")
Just select and copy the text to the clipboard and then run in the console: