This file contains 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
# tips on reading a Google Spreadsheet: | |
# http://blog.revolution-computing.com/2009/09/how-to-use-a-google-spreadsheet-as-data-in-r.html | |
# Data taken from:"https://spreadsheets.google.com/ccc?key=0AgdO92JOXxAOdDVlaUpkNlB2WERtV3l1ZVFYbzllQWc" | |
# http://www.guardian.co.uk/news/datablog/2010/feb/11/winter-olympics-medals-by-country | |
googleLink <- "http://spreadsheets.google.com/pub?key=tsddww6vOYePkhPSxRpDeYw&single=true&gid=1&output=csv" | |
medals <- read.csv(googleLink, stringsAsFactors = FALSE) | |
savePlot <- TRUE # optional variable used to save or not save plots in code | |
# remove rows that do not contain data |
This file contains 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
# Example from: http://jeromyanglim.blogspot.com/2009/10/factor-analysis-in-r.html | |
# Jeromy Anglim | |
# Required packages. | |
require(psych); | |
require(foreign); | |
# Import data from SPSS data file. | |
personality <- foreign::read.spss("spss\\personality.sav", | |
to.data.frame = TRUE) |
This file contains 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
hello_world <- function() { | |
print("Hello World") | |
} | |
hello_world() |
This file contains 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
# Experiment | |
<expt ability> | |
/preinstructions = (initial.instructions) | |
/blocks=[ | |
1=pm.simple; | |
2=pm.4choice; | |
3=ac.test.type] | |
</expt> | |
<data> |
This file contains 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
# Get data | |
x <- c(93150, 93116, 93096, 93085, 92923, 92823, 92745, 92150, 91785, 91775, | |
91775, 91735, 91727, 91633, 91616, 91604, 91587, 91579, 91488, 91427, 91398, | |
91339, 91338, 91290, 91268, 91084, 91072, 90909, 86164, 85372, 83835, 83428, | |
81372, 81281, 81238, 81195, 81131, 81030, 81011, 80730, 80721, 80682, 80666, | |
80585, 80565, 80534, 80497, 80464, 80374, 80226, 80223, 80178, 80178, 80147, | |
80137, 80111, 80048, 80027, 79948, 79902, 79818, 79785, 79752, 79675, 79651, | |
79620, 79586, 79535, 79491, 79388, 79277, 79269, 79254, 79194, 79191, 79180, | |
79170, 79162, 79154, 79142, 79129, 79090, 79062, 79039, 79011, 78981, 78979, | |
78936, 78923, 78913, 78829, 78809, 78742, 78735, 78725, 78618, 78606, 78577, |
This file contains 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
6162.178176 0.049820046 | |
4675.14432 0.145022261 | |
5969.056896 0.47210138 | |
5357.506176 0.052263122 | |
33.796224 16.45154204 | |
6162.178176 0.064262991 | |
6725.448576 0.419005508 | |
3247.656192 0.867394771 | |
5357.506176 0.052263122 | |
3612.97728 0.091337414 |
This file contains 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
#http://jeromyanglim.blogspot.com.au/2012/05/how-to-plot-three-categorical-variables.html | |
library(ggplot2) | |
# Create some data | |
set.seed(4444) | |
Data <- expand.grid(group=c("Apples", "Bananas", "Carrots", "Durians", "Eggplants"), | |
year=c("2000", "2001", "2002"), | |
quality=c("Grade A", "Grade B", "Grade C", "Grade D", "Grade E")) | |
Group.Weight <- data.frame( | |
group=c("Apples", "Bananas", "Carrots", "Durians", "Eggplants"), |
This file contains 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
<expt ability> | |
/preinstructions = (initial.instructions) | |
/blocks=[1=pm.simple; 2=pm.4choice; 3=ac.test.type] | |
</expt> | |
<data> | |
/columns=[date, time, build, subject, trialcode, blockcode, blocknum, trialnum, latency, response, pretrialpause, | |
posttrialpause, trialtimeout, blocktimeout, correct, stimulusitem, stimulusnumber, | |
display.height, display.width, | |
computer.cpuspeed, computer.os, |
This file contains 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
<script type="text/javascript" | |
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"> | |
</script> | |
<script type="text/javascript">MathJax.Hub.Config({tex2jax: {processEscapes: true, | |
processEnvironments: false, inlineMath: [ ['$','$'] ], | |
displayMath: [ ['$$','$$'] ] }, | |
asciimath2jax: {delimiters: [ ['$','$'] ] }, | |
"HTML-CSS": {minScaleAdjust: 125 } }); | |
</script> |
This file contains 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
This post examines the features of [R Markdown](http://www.rstudio.org/docs/authoring/using_markdown) | |
using [knitr](http://yihui.name/knitr/) in Rstudio 0.96. | |
This combination of tools provides an exciting improvement in usability for | |
[reproducible analysis](http://stats.stackexchange.com/a/15006/183). | |
Specifically, this post | |
(1) discusses getting started with R Markdown and `knitr` in Rstudio 0.96; | |
(2) provides a basic example of producing console output and plots using R Markdown; | |
(3) highlights several code chunk options such as caching and controlling how input and output is displayed; | |
(4) demonstrates use of standard Markdown notation as well as the extended features of formulas and tables; and | |
(5) discusses the implications of R Markdown. |
OlderNewer