<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" gd:etag="W/&quot;DkECSHY9cCp7ImA9WhBaE0o.&quot;"><id>tag:blogger.com,1999:blog-8909074830238091680</id><updated>2013-05-24T15:51:09.868+10:00</updated><category term="qualitative research" /><category term="mediation" /><category term="data mining" /><category term="reproducible research" /><category term="path analysis" /><category term="general advice" /><category term="version_control" /><category term="measurement" /><category term="matrix algebra" /><category term="ggplot2" /><category term="method" /><category term="bayesian" /><category term="summary post" /><category term="make" /><category term="Australia" /><category term="academia" /><category term="psychology" /><category term="RSS" /><category term="binary variable" /><category term="multilevel" /><category term="I/O Psych" /><category term="Sweave" /><category term="personality" /><category term="reliability" /><category term="meta-analysis" /><category term="CFA" /><category term="vim" /><category term="normality" /><category term="data sharing" /><category term="probability" /><category term="repeated measures" /><category term="market research" /><category term="Beamer" /><category term="outliers" /><category term="experiments" /><category term="formatting" /><category term="moderation" /><category term="scales" /><category term="Word" /><category term="computers" /><category term="opinion" /><category term="software" /><category term="Eclipse" /><category term="APAStyle" /><category term="book review" /><category term="tetrachoric" /><category term="power" /><category term="job satisfaction" /><category term="interviews" /><category term="design" /><category term="regular expressions" /><category term="fun" /><category term="statistics" /><category term="validity" /><category term="social network analysis" /><category term="correlation" /><category term="blogging" /><category term="GEE" /><category term="reaction time" /><category term="Excel" /><category term="Twitter" /><category term="introduction" /><category term="cluster analysis" /><category term="discriminant function analysis" /><category term="BibTeX" /><category term="OpenMX" /><category term="bootstrapping" /><category term="polychoric" /><category term="factor analysis" /><category term="Inquisit" /><category term="jags" /><category term="tables" /><category term="SPSS" /><category term="Endnote" /><category term="SEM" /><category term="results" /><category term="nonlinear regression" /><category term="markdown" /><category term="internet" /><category term="modelling" /><category term="causation" /><category term="JabRef" /><category term="Writing" /><category term="focus groups" /><category term="pandoc" /><category term="markup" /><category term="teaching" /><category term="ability" /><category term="skill acquisition" /><category term="presentations" /><category term="thinking" /><category term="linux" /><category term="dyads" /><category term="logistic regression" /><category term="descriptive statistics" /><category term="statistical consulting" /><category term="multiple regression" /><category term="Literate programming" /><category term="selection and recruitment" /><category term="programming" /><category term="random" /><category term="videos" /><category term="calculus" /><category term="WinEdt" /><category term="publishing" /><category term="basic analyses" /><category term="Jing" /><category term="literature review" /><category term="tests" /><category term="ordinal variables" /><category term="surveys" /><category term="Article Deconstruction" /><category term="StatET" /><category term="mathematics" /><category term="missing data" /><category term="references" /><category term="difference scores" /><category term="metadata" /><category term="LaTeX" /><category term="stackexchange" /><category term="sampling" /><category term="R" /><title>Jeromy Anglim's Blog: Psychology and Statistics</title><subtitle type="html">Posts on statistics, study design, statistical computing, R, and more with a focus on research applications in psychology.</subtitle><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://jeromyanglim.blogspot.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://jeromyanglim.blogspot.com/" /><link rel="next" type="application/atom+xml" href="http://www.blogger.com/feeds/8909074830238091680/posts/default?start-index=26&amp;max-results=25&amp;redirect=false&amp;v=2" /><author><name>Jeromy Anglim</name><uri>https://plus.google.com/100803004599943057656</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-xUmT1aa-RI0/AAAAAAAAAAI/AAAAAAAAAvk/eN47FjC3uVU/s512-c/photo.jpg" /></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>189</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/jeromyanglim" /><feedburner:info uri="jeromyanglim" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>jeromyanglim</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><entry gd:etag="W/&quot;Dk8CQ3c_eCp7ImA9WhBQE04.&quot;"><id>tag:blogger.com,1999:blog-8909074830238091680.post-2956889784848766090</id><published>2013-03-15T18:55:00.000+11:00</published><updated>2013-03-15T19:07:42.940+11:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-03-15T19:07:42.940+11:00</app:edited><title>Google Reader Replacements: Feedly and The Old Reader</title><content type="html">This post discusses the impending demise of Google Reader and configuring Feedly as a replacement.&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;
&lt;!-- break --&gt;


&lt;br /&gt;
&lt;h3&gt;
Demise of Google Reader&lt;/h3&gt;
I was very disappointed to read about Google terminating its &lt;a href="http://googleblog.blogspot.com.au/2013/03/a-second-spring-of-cleaning.html"&gt;Google Reader&lt;/a&gt; service.

&lt;br /&gt;
Google Reader provided me with a great tool for following hundreds of blogs, journals, and assorted feeds.
The interface was clean and efficient. 
I liked the keyboard shortcuts for navigation.

&lt;br /&gt;
Some people are saying that Google+, Twitter, Facebook, Reddit, email newsletters, and so on are a substitute for Google Reader. This is rubbish. Google Reader is an efficient way of consuming and scanning new content based on providers that I care about. None of these other tools provide anything like this.

&lt;br /&gt;
&lt;br /&gt;
For bloggers the concern about the end of Google Reader is that this is one of the major ways that people consume blog content. Even my own small blog has around a thousand RSS subscribers. The most popular RSS reader is Google Reader, and thus there is the concern that the closure of Google Reader may damage this connection between blogs and subscribers. As a consequence we might see fewer subscribers and then fewer incentives to blog and then less great blog content. Thus, I really hope that one or more high quality, trustworthy, multi-device, free web services emerge that continue to provide a great RSS reading experience. Hopefully, this is an opportunity for a service to emerge that is even better than Google Reader.

&lt;br /&gt;
&lt;h3&gt;
Feedly&lt;/h3&gt;
After an initial exploration I am having a good experience with &lt;a href="http://www.feedly.com/"&gt;Feedly&lt;/a&gt;.
When you log into Feedly with your Google Account, it immediately synchronises with your Google Reader account.
Supposedly Feedly will switch to their own backend when the Google Reader service ends.
Nonetheless, I have still exported my feeds directly from Google Reader using the Google Reader export facilities.&lt;br /&gt;
&lt;br /&gt;
I must admit that my first impressions of Feedly were worrying. However, a little persistence showed that I could replicate the Google Reader workflow.

&lt;br /&gt;
&lt;br /&gt;
First, Feedly runs both in the browser and on various mobile devices. 
One drawback is that it does require the installation of a browser plugin and an app on mobile devices. But given that I have admin privileges, this wasn't a major issue.

&lt;br /&gt;
&lt;br /&gt;
To configure like Google Reder see this &lt;a href="http://blog.feedly.com/2013/03/14/tips-for-google-reader-users-migrating-to-feedly/"&gt;blog post for a few tips&lt;/a&gt;. 

&lt;br /&gt;
&lt;br /&gt;
After a few customisation steps I'm very happy.
In particular: (1) I set tile view for each of my categories; (2) I saved a bookmark in my browser for feedly to be a particular category. I have my main feeds in a category called "core". This means that the default view when I click on the bookmark is like I'm used to in Google Reader. I find the default Feedly homepage annoying; (3) I learnt the keyboard shortcuts, in particular j and k for navigating between posts (I had to set an exception on Vimium). This was something that I really liked in Google Reader and it's great to see it still available in Feedly. Pressing question mark on the keyboard brings up available shortcut keys.

&lt;br /&gt;
That said, it is early days and there are a lot of discussions about what service offers the best Google Reader replacement. I also need to build up trust when it comes to a provider of RSS services. I still need to see whether the migration from the Google Reader backend will be effective. I also don't yet understand feedly's business model and therefore wonder how they will provide the service in the longer term. 

&lt;br /&gt;
&lt;h3&gt;
Alternatives&lt;/h3&gt;
There's a discussion here of some of the &lt;a href="http://webapps.stackexchange.com/questions/41591/alternatives-for-google-reader"&gt;alternatives&lt;/a&gt;.

&lt;br /&gt;
&lt;br /&gt;
The Old Reader appears to be a popular choice. It offers an interface nearly identical to Google Reder. It doesn't require a browser plug-in. The &lt;a href="http://blog.theoldreader.com/"&gt;development seems friendly&lt;/a&gt;. It also did a better job of rendering a few posts with mathematics (e.g., posts from the &lt;a href="http://normaldeviate.wordpress.com/"&gt;Normal Deviate&lt;/a&gt;, which Feedly struggled with).

&lt;br /&gt;
&lt;br /&gt;
Anyway, it's nice that at the moment there are at least two reasonable replacements to Google Reader. Presumably much more will evolve in terms of the preferred option over the coming weeks and months.


&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=OfOf9T2IEyU:ondQf785GfM:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=OfOf9T2IEyU:ondQf785GfM:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=OfOf9T2IEyU:ondQf785GfM:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=OfOf9T2IEyU:ondQf785GfM:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=OfOf9T2IEyU:ondQf785GfM:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=OfOf9T2IEyU:ondQf785GfM:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=OfOf9T2IEyU:ondQf785GfM:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=OfOf9T2IEyU:ondQf785GfM:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=OfOf9T2IEyU:ondQf785GfM:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/jeromyanglim/~4/OfOf9T2IEyU" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://jeromyanglim.blogspot.com/feeds/2956889784848766090/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://jeromyanglim.blogspot.com/2013/03/google-reader-replacements-feedly-and.html#comment-form" title="6 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8909074830238091680/posts/default/2956889784848766090?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8909074830238091680/posts/default/2956889784848766090?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/jeromyanglim/~3/OfOf9T2IEyU/google-reader-replacements-feedly-and.html" title="Google Reader Replacements: Feedly and The Old Reader" /><author><name>Jeromy Anglim</name><uri>https://plus.google.com/100803004599943057656</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-xUmT1aa-RI0/AAAAAAAAAAI/AAAAAAAAAvk/eN47FjC3uVU/s512-c/photo.jpg" /></author><thr:total>6</thr:total><feedburner:origLink>http://jeromyanglim.blogspot.com/2013/03/google-reader-replacements-feedly-and.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0EAQ38_eyp7ImA9WhJQEEk.&quot;"><id>tag:blogger.com,1999:blog-8909074830238091680.post-3701350170539785240</id><published>2012-07-23T23:20:00.000+10:00</published><updated>2012-07-23T23:20:42.143+10:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-07-23T23:20:42.143+10:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="markdown" /><category scheme="http://www.blogger.com/atom/ns#" term="LaTeX" /><category scheme="http://www.blogger.com/atom/ns#" term="make" /><category scheme="http://www.blogger.com/atom/ns#" term="pandoc" /><title>Beamer presentations using pandoc, markdown, LaTeX, and a makefile</title><content type="html">&lt;p&gt;This post discusses the creation of beamer presentations using a combination of
markdown, pandoc, and LaTeX. This workflow offers the potential to reduce typing
and increase readability of beamer presentation source code. Source code for an example
presentation is provided containing markdown and LaTeX source code along with
a makefile for building the beamer PDF. &lt;/p&gt;

&lt;a name='more'&gt;&lt;/a&gt;

&lt;h3&gt;Motivation&lt;/h3&gt;

&lt;p&gt;I've used beamer quite a lot to prepare slides for both research and teaching
purposes (e.g., 
&lt;a href="https://github.com/jeromyanglim/RMeetup_Workflow"&gt;this 2010 presentation on R Workflow&lt;/a&gt;). 
I've also written up a 
&lt;a href="http://jeromyanglim.blogspot.com.au/2010/08/getting-started-with-beamer-tips-and.html"&gt;guide to getting started with beamer&lt;/a&gt; and 
&lt;a href="http://jeromyanglim.blogspot.com.au/2010/08/simple-beamer-template-for-getting.html"&gt;a simple beamer template&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Nonetheless, for some time I've been concerned about the high ratio of markup to
content in beamer presentations. I even asked a question on TeX.SE on &lt;a href="http://tex.stackexchange.com/questions/1264/typing-and-editing-beamer-presentations"&gt;strategies
for dealing with this
issue&lt;/a&gt;.
I find that beamer markup is a burden. It interferes with content creation.
Creating, editing, and re-arranging slides is more difficult than it needs to
be. The high quantity of markup also interferes with readability.&lt;/p&gt;

&lt;p&gt;Several ways of dealing with this.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://tex.stackexchange.com/questions/4106/what-are-a-good-set-of-macros-for-writing-beamer-presentations?lq=1"&gt;Use LaTeX macros&lt;/a&gt;: I.e., to shorten common environments. 
However, this reduces readability if it is ad hoc.&lt;/li&gt;
&lt;li&gt;&lt;a href="http://tex.stackexchange.com/a/1303/151"&gt;Org Mode in Emacs&lt;/a&gt;. This sounds
good, but I'm more experienced with Vim.&lt;/li&gt;
&lt;li&gt;Code Snippets. Code snippets partially solve the typing issue, but they don't
solve the readability issue.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In the end, I decided to explore the combination of pandoc, markdown, and LaTeX
to create a beamer presentation.
The reasons for this included that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://daringfireball.net/projects/markdown/"&gt;Markdown&lt;/a&gt; is a really intuitive
markup format that is easy to read and easy to modify.&lt;/li&gt;
&lt;li&gt;When pandoc converts markdown to LaTeX, any LaTeX is passed straight through. Thus,
it is possible to obtain customisation beyond the basic options provided by
markdown.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Existing resources on combining Beamer, markdown and pandoc&lt;/h3&gt;

&lt;p&gt;John MacFarlane, author of pandoc, has some &lt;a href="http://johnmacfarlane.net/pandoc/demo/example9/producing-slide-shows-with-pandoc.html"&gt;relevant documentation on slide
production&lt;/a&gt;
Important points:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The basic compilation command is: &lt;code&gt;pandoc -t beamer my_source.md -o my_beamer.pdf&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;The post explains the slide separation rules. &lt;/li&gt;
&lt;li&gt;You can have incremental lists by pre-pending dot points with the greater than symbol &lt;/li&gt;
&lt;li&gt;Beamer Themes can be used via the &lt;code&gt;-V&lt;/code&gt; option e.g., (&lt;code&gt;-V theme:Warsaw&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;It shows how the first few lines of the file pre-pended by &lt;code&gt;%&lt;/code&gt; are incorporated into the title slide&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Stephen Sinclair &lt;a href="http://www.music.mcgill.ca/~sinclair/content/blog/using_markdown_for_beamer_presentations"&gt;has a tutorial&lt;/a&gt;.
Relevant points include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Latex gets passed directly through
&lt;ul&gt;
&lt;li&gt;Equations can be passed directly through&lt;/li&gt;
&lt;li&gt;Image size and placement can be controlled in detail with latex e.g., &lt;code&gt;\centerline{\includegraphics[height=2in]{my_image.pdf}}&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;You can use bibtex for citations&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;He also mentions a number of other options for compiling the document
involving templates, regular expressions, and so on. &lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;My approach&lt;/h3&gt;

&lt;p&gt;My approach involved running a makefile which converted a markdown file into
a tex file, which was then incorporated into another tex file and then converted
into a pdf. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The repository containing all files is available on github:
&lt;a href="https://github.com/jeromyanglim/rmarkdown-rmeetup-2012/tree/master/talk"&gt;https://github.com/jeromyanglim/rmarkdown-rmeetup-2012/tree/master/talk&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;The &lt;a href="https://github.com/jeromyanglim/rmarkdown-rmeetup-2012/blob/master/talk/main.pdf?raw=true"&gt;presentation PDF&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To use the approach you would need the following software:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;LaTeX distribution with beamer package&lt;/li&gt;
&lt;li&gt;&lt;a href="http://johnmacfarlane.net/pandoc/"&gt;pandoc&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;support for &lt;code&gt;make&lt;/code&gt;: On Linux, make is installed by default; on Windows, you may
need something like &lt;a href="http://www.cygwin.com/"&gt;cygwin&lt;/a&gt; or
&lt;a href="http://cran.r-project.org/bin/windows/Rtools/"&gt;Rtools&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;makefile&lt;/h4&gt;

&lt;p&gt;The makefile was as follows:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;pdf:
    pandoc talk.md --slide-level 2 -t beamer -o talk.tex
    pdflatex main.tex
    pdflatex main.tex
    -xdg-open main.pdf
&lt;/code&gt;&lt;/pre&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;pandoc&lt;/code&gt; converted &lt;code&gt;talk.md&lt;/code&gt; into a beamer latex file &lt;code&gt;talk.tex&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--slide-level 2&lt;/code&gt; meant that level 1 markdown headings (i.e., lines preceded
with a single hash: &lt;code&gt;# Section name&lt;/code&gt;) represented section headings used in the
presentation, and level 2 headings (i.e., lines preceded with two hashes &lt;code&gt;##
Slide Title&lt;/code&gt;) represented new slides and their title.&lt;/li&gt;
&lt;li&gt;The line &lt;code&gt;-xdg-open main.pdf&lt;/code&gt; opens the resulting pdf file on Linux, but
&lt;code&gt;xdg-open&lt;/code&gt;
could be replaced by the name of pdf viewer (e.g., on a different operating system).&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Preamble LaTeX file: &lt;code&gt;main.tex&lt;/code&gt;&lt;/h4&gt;

&lt;p&gt;I had a main LaTeX file (&lt;code&gt;main.tex&lt;/code&gt;) as follows: &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;\documentclass[t]{beamer}  
\usetheme{Berkeley}                 
\setbeamertemplate{navigation symbols}{}
\title{MY_TALK_TITLE}
\subtitle{MY_TALK_SUBTITLE}
\author{MY_NAME}
\institute{MY_INSTITUTION}
\date{DATE_OF_MY_TALK}

% more preamble...

\begin{document}
\begin{frame}
\titlepage
\end{frame}

\begin{frame}
\frametitle{Outline}
\tableofcontents
\end{frame}

\input{"talk.tex"}

\end{document}
&lt;/code&gt;&lt;/pre&gt;

&lt;ul&gt;
&lt;li&gt;The file is completely in latex and includes the preamble the document
environment, some opening slides with particular features, and the input
command which reads in the file &lt;code&gt;talk.tex&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;talk.tex&lt;/code&gt; is generated by pandoc from &lt;code&gt;talk.md&lt;/code&gt; and contains all the
individual content slides.&lt;/li&gt;
&lt;li&gt;I prefer to exclude navigation symbols.&lt;/li&gt;
&lt;li&gt;Naturally, &lt;code&gt;usetheme&lt;/code&gt; could be altered to some other theme (see the &lt;a href="http://www.hartwork.org/beamer-theme-matrix/"&gt;beamer
theme matrix&lt;/a&gt;), such as &lt;code&gt;default&lt;/code&gt;. &lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Body markdown slide file: &lt;code&gt;talk.md&lt;/code&gt;&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;talk.md&lt;/code&gt; contained all the individual markdown slides.&lt;/p&gt;

&lt;p&gt;For example a basic slide might look as follows:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;# NAME OF A SECTION
## SLIDE TITLE
* Some point to make
    * Another point
    * Another point
* Some point to make
    * Another point
    * Another point
&lt;/code&gt;&lt;/pre&gt;

&lt;ul&gt;
&lt;li&gt;The first line adds a section title. This is not part of the slide, but can be
used to generate table of contents, and in slide navigation.&lt;/li&gt;
&lt;li&gt;The second line starts a new slide with the content to the right of the double
hash constituting the slide title.&lt;/li&gt;
&lt;li&gt;And then subsequent lines generate a two-level list represented in LaTeX using
the &lt;code&gt;itemize&lt;/code&gt; environment.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In general, markdown is converted by pandoc into sensible beamer content. See the &lt;a href="https://raw.github.com/jeromyanglim/rmarkdown-rmeetup-2012/master/talk/talk.md"&gt;actual
markdown file talk.md&lt;/a&gt;
and resulting &lt;a href="https://raw.github.com/jeromyanglim/rmarkdown-rmeetup-2012/master/talk/talk.tex"&gt;tex file talk.tex&lt;/a&gt;.
However, pandoc passes any LaTeX through as is, and this is sometimes required.&lt;/p&gt;

&lt;p&gt;For incorporating images, I found the default markdown image command led to an
excessively large image.
Thus, I used LaTeX for images. 
I'd like to think that there is a way of making default images work well, but
I didn't work it out.
Thus, instead, I used commands like the following:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;## SLIDE TITLE
\includegraphics[width=4in]{FIGURE_FILE_NAME.PNG}
&lt;/code&gt;&lt;/pre&gt;

&lt;ul&gt;
&lt;li&gt;I often had to tweak the image width to get it the right size.&lt;/li&gt;
&lt;li&gt;I also read about some other options, which I &lt;a href="https://github.com/jeromyanglim/rmarkdown-rmeetup-2012/issues/4#issuecomment-6952495"&gt;discuss
here&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Obviously there are many reasons that you might want to fall back to LaTeX.
In my talk, I tried to keep things simple, so the main instances were:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Images as shown above&lt;/li&gt;
&lt;li&gt;Small text for footnotes often with a url inside: e.g., &lt;code&gt;\tiny{some text and
a link: \url{http://jeromyanglim.blogspot.com}}&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Large text at the end of the talk: e.g., &lt;code&gt;\begin{center} \LARGE{Questions?} \end{center}&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Conclusion&lt;/h3&gt;

&lt;p&gt;Overall, there were pros and cons to the approach I adopted. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;By incorporating markdown and pandoc, there was an extra layer of complexity
to think about to ensure that the conversion process had the desired effect.
Error messages were sometimes more difficult to diagnose. &lt;/li&gt;
&lt;li&gt;There were a lot of situations where you might want to have more control
over slide content than what you get by default with Markdown. &lt;/li&gt;
&lt;li&gt;There is an argument to suggest that slide creation is best in a WYSIWIG
environment where you can manually tweak image positioning and layout. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Nonetheless, I really liked how easy it was to create, edit, and read dot points,
nested dot points, frames, sections, and basic formatting, and in general it was
relatively easy to incorporate LaTeX when required.
I also like the idea of where possible using open plain-text file formats to
take advantage of easier programmability, version control, incorporating into
a powerful text editor, simpler conversion, and so on.&lt;/p&gt;

&lt;h3&gt;Other aspects&lt;/h3&gt;

&lt;p&gt;The following are a few other aspects that might interest some readers,
particularly Vim users.&lt;/p&gt;

&lt;h4&gt;Syntax highlighting of markdown+LaTeX in Vim&lt;/h4&gt;

&lt;p&gt;There is a Vim plugin for pandoc that provides many features including syntax
highlighting for documents that combine multiple markups including markdown and
LaTeX. I found it best to install the latest version available on github:
&lt;a href="https://github.com/vim-pandoc/vim-pandoc"&gt;https://github.com/vim-pandoc/vim-pandoc&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;Code folding of markdown-Beamer&lt;/h4&gt;

&lt;p&gt;I also have the following script in my &lt;code&gt;.vimrc file&lt;/code&gt;. 
The great thing about it is that it allows code folding if you use hash style
markdown headings.
It is setup to only fold on headings 1 and 2. 
This corresponds to sections and slides in my pandoc setting for beamer markdown documents.
To increase the level, change it to &lt;code&gt;MarkdownLevel(3)&lt;/code&gt;, etc.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;function! MarkdownLevel(maxlevel)
    if a:maxlevel &amp;gt;= 1 &amp;amp;&amp;amp; getline(v:lnum) =~ '^# .*$'
        return "&amp;gt;1"
    endif
    if a:maxlevel &amp;gt;= 2 &amp;amp;&amp;amp; getline(v:lnum) =~ '^## .*$'
        return "&amp;gt;2"
    endif
    if a:maxlevel &amp;gt;= 3 &amp;amp;&amp;amp; getline(v:lnum) =~ '^### .*$'
        return "&amp;gt;3"
    endif
    if a:maxlevel &amp;gt;= 4 &amp;amp;&amp;amp; getline(v:lnum) =~ '^#### .*$'
        return "&amp;gt;4"
    endif
    if a:maxlevel &amp;gt;= 5 &amp;amp;&amp;amp; getline(v:lnum) =~ '^##### .*$'
        return "&amp;gt;5"
    endif
    if a:maxlevel &amp;gt;= 6 &amp;amp;&amp;amp; getline(v:lnum) =~ '^###### .*$'
        return "&amp;gt;6"
    endif
    return "=" 
endfunction

au BufEnter *.md  setlocal foldexpr=MarkdownLevel(2)  
au BufEnter *.md  setlocal foldmethod=expr     
au BufEnter *.md  setlocal autoindent
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Then the following Vim commands in normal model make folding, navigation, and
getting a sense of structure really easy:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;zx&lt;/code&gt; show current line and necessary headings; close other headings&lt;/li&gt;
&lt;li&gt;&lt;code&gt;zc&lt;/code&gt; close heading&lt;/li&gt;
&lt;li&gt;&lt;code&gt;zj&lt;/code&gt; and &lt;code&gt;zk&lt;/code&gt; to move down and up headings&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Showing backticks and single quotes properly in code&lt;/h4&gt;

&lt;p&gt;I often need to show code, and backticks and single quotes weren't showing
properly.
The following code in my LaTeX preamble drawn from &lt;a href="http://tex.stackexchange.com/questions/63353/"&gt;this TeX.SE
question&lt;/a&gt; solved the problem:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;% enables straight single quote
\makeatletter
\let \@sverbatim \@verbatim
\def \@verbatim {\@sverbatim \verbatimplus}
{\catcode`'=13 \gdef \verbatimplus{\catcode`'=13 \chardef '=13 }} 
\makeatother

% enables backticks in verbatim
\makeatletter
{\catcode`\`=13
\xdef\@verbatim{\unexpanded\expandafter{\@verbatim}\chardef\noexpand`=18 }
}
\makeatother
&lt;/code&gt;&lt;/pre&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=KYeVj6JTdO8:TSPzaq4O-88:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=KYeVj6JTdO8:TSPzaq4O-88:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=KYeVj6JTdO8:TSPzaq4O-88:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=KYeVj6JTdO8:TSPzaq4O-88:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=KYeVj6JTdO8:TSPzaq4O-88:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=KYeVj6JTdO8:TSPzaq4O-88:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=KYeVj6JTdO8:TSPzaq4O-88:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=KYeVj6JTdO8:TSPzaq4O-88:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=KYeVj6JTdO8:TSPzaq4O-88:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/jeromyanglim/~4/KYeVj6JTdO8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://jeromyanglim.blogspot.com/feeds/3701350170539785240/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://jeromyanglim.blogspot.com/2012/07/beamer-pandoc-markdown.html#comment-form" title="6 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8909074830238091680/posts/default/3701350170539785240?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8909074830238091680/posts/default/3701350170539785240?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/jeromyanglim/~3/KYeVj6JTdO8/beamer-pandoc-markdown.html" title="Beamer presentations using pandoc, markdown, LaTeX, and a makefile" /><author><name>Jeromy Anglim</name><uri>https://plus.google.com/100803004599943057656</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-xUmT1aa-RI0/AAAAAAAAAAI/AAAAAAAAAvk/eN47FjC3uVU/s512-c/photo.jpg" /></author><thr:total>6</thr:total><feedburner:origLink>http://jeromyanglim.blogspot.com/2012/07/beamer-pandoc-markdown.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Ck4BQ307eCp7ImA9WhJRFkU.&quot;"><id>tag:blogger.com,1999:blog-8909074830238091680.post-4395054286470251205</id><published>2012-07-19T16:55:00.000+10:00</published><updated>2012-07-19T16:55:52.300+10:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-07-19T16:55:52.300+10:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="reproducible research" /><category scheme="http://www.blogger.com/atom/ns#" term="videos" /><category scheme="http://www.blogger.com/atom/ns#" term="markdown" /><category scheme="http://www.blogger.com/atom/ns#" term="tables" /><category scheme="http://www.blogger.com/atom/ns#" term="Sweave" /><category scheme="http://www.blogger.com/atom/ns#" term="R" /><title>Video: knitr, R Markdown, and R Studio: Introduction to Reproducible Analysis</title><content type="html">&lt;p&gt;This post presents the video of a talk that I presented in July 2012 at
Melbourne R Users on using knitr, R Markdown, and R Studio to perform
reproducible analysis. I also provide links to a github repository where the
R markdown examples can be examined and the slides can be downloaded.&lt;/p&gt;

&lt;a name='more'&gt;&lt;/a&gt;

&lt;h3&gt;Talk Overview&lt;/h3&gt;

&lt;p&gt;Reproducible analysis represents a process for transforming text, code, and data
to produce reproducible artefacts including reports, journal articles,
slideshows, theses, and books.  Reproducible analysis is important in both
industry and academic settings for ensuring a high quality product.  R has
always provided a powerful platform for reproducible analysis.  However, in the
first half of 2012, several new tools have emerged that have substantially
increased the ease with which reproducible analysis can be performed. In
particular, knitr, R Markdown, and RStudio combine to create a user-friendly and
powerful set of open source tools for reproducible analysis.&lt;/p&gt;

&lt;p&gt;Specifically, in the talk I discuss caching slow analyses, producing attractive plots and
tables, and using RStudio as an IDE.  I present three live examples of using
R Markdown. I also show how the markdown package on CRAN can be
used to work with other R development environments and workflows for report
production.  &lt;/p&gt;

&lt;p&gt;There is a &lt;a href="https://github.com/jeromyanglim/rmarkdown-rmeetup-2012"&gt;github repository called rmarkdown-rmeetup-2012&lt;/a&gt;
that contains: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;the slides and source code for the slides (I used a combination of beamer, markdown, and pandoc)&lt;/li&gt;
&lt;li&gt;the source code for the R Markdown examples presented in the talk&lt;/li&gt;
&lt;li&gt;and assorted brainstorming that recorded some of my thinking as I developed the slides 
(see &lt;a href="https://github.com/jeromyanglim/rmarkdown-rmeetup-2012/issues?state=closed"&gt;the issue tracker&lt;/a&gt;)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Follow this &lt;a href="https://github.com/jeromyanglim/rmarkdown-rmeetup-2012/blob/master/talk/main.pdf?raw=true"&gt;link to download the slides directly&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;Video of Talk&lt;/h3&gt;

&lt;p&gt;The talk is split over two parts.&lt;/p&gt;

&lt;iframe width="420" height="315" src="http://www.youtube.com/embed/XqzHnYLr5BE"
frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;

&lt;iframe width="420" height="315" src="http://www.youtube.com/embed/fNmMgHmjU2w" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;

&lt;h3&gt;More Videos from Melbourne R Users&lt;/h3&gt;

&lt;p&gt;We are gradually building up a fairly large back catalogue of videos about R all
presented at &lt;a href="http://www.meetup.com/MelbURN-Melbourne-Users-of-R-Network/"&gt;Melbourne R Users&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The &lt;a href="http://www.youtube.com/playlist?list=PL2E4B515A6ED513B0"&gt;playlist of Melbourne R Users Videos can be viewed here&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;Relevant links:&lt;/h3&gt;

&lt;p&gt;The following links were either presented in the talk or are otherwise relevant to reproducible analysis.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;My post on &lt;a href="http://jeromyanglim.blogspot.com/2012/05/getting-started-with-r-markdown-knitr.html"&gt;getting started with R Markdown&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;My thoughts on &lt;a href="http://stats.stackexchange.com/a/15006/183"&gt;definitions of reproducible data analysis&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;My thoughts on &lt;a href="https://github.com/jeromyanglim/rmarkdown-rmeetup-2012/issues/11"&gt;degrees of reproducible data analysis&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://cran.r-project.org/web/views/ReproducibleResearch.html"&gt;Reproducible Research Task View on CRAN&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Software used in talk: &lt;a href="http://www.r-project.org/"&gt;R&lt;/a&gt;, &lt;a href="http://rstudio.org/"&gt;R Studio&lt;/a&gt;, &lt;a href="http://johnmacfarlane.net/pandoc/"&gt;pandoc&lt;/a&gt;
&lt;a href="http://www.latex-project.org/ftp.html"&gt;TeX distributions&lt;/a&gt;, &lt;/li&gt;
&lt;li&gt;&lt;a href="http://daringfireball.net/projects/markdown/"&gt;Overview of markdown&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2010/10/getting-started-with-writing.html"&gt;Getting started with writing LaTeX equations&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://yihui.name/slides/2012-knitr-RStudio.html"&gt;Slide show on benefits of knitr and Rstudio by Yihui Xie and JJ Allaire&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://yihui.name/knitr/options"&gt;knitr options home page&lt;/a&gt; and &lt;a href="http://yihui.name/knitr/"&gt;knitr home page&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://rstudio.org/docs/authoring/using_markdown"&gt;Documentation on using R Markdown with R Studio&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/search/label/reproducible%20research"&gt;My existing posts on reproducible analysis&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Places to ask questions: &lt;a href="http://stackoverflow.com/questions/tagged/r"&gt;R on StackOverflow&lt;/a&gt;,
&lt;a href="http://tex.stackexchange.com/"&gt;LaTeX on TeX.SE&lt;/a&gt;, and &lt;a href="https://github.com/yihui/knitr/issues"&gt;knitr on github&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Extensive &lt;a href="http://www.youtube.com/user/victoriastodden/videos?view=0"&gt;set of YouTube videos on reproducible analysis&lt;/a&gt; largely
drawn from a workshop on "Reproducible Research: Tools and Strategies for Scientific Computing".&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If viewing through syndication, feel free to &lt;a href="http://feeds.feedburner.com/jeromyanglim"&gt;subscribe to my blog on psychology and statistics here&lt;/a&gt;.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=qtmaKVCV6_0:GsJJV6E4JxM:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=qtmaKVCV6_0:GsJJV6E4JxM:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=qtmaKVCV6_0:GsJJV6E4JxM:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=qtmaKVCV6_0:GsJJV6E4JxM:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=qtmaKVCV6_0:GsJJV6E4JxM:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=qtmaKVCV6_0:GsJJV6E4JxM:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=qtmaKVCV6_0:GsJJV6E4JxM:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=qtmaKVCV6_0:GsJJV6E4JxM:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=qtmaKVCV6_0:GsJJV6E4JxM:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/jeromyanglim/~4/qtmaKVCV6_0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://jeromyanglim.blogspot.com/feeds/4395054286470251205/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://jeromyanglim.blogspot.com/2012/07/video-knitr-rmarkdown-rstudio.html#comment-form" title="4 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8909074830238091680/posts/default/4395054286470251205?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8909074830238091680/posts/default/4395054286470251205?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/jeromyanglim/~3/qtmaKVCV6_0/video-knitr-rmarkdown-rstudio.html" title="Video: knitr, R Markdown, and R Studio: Introduction to Reproducible Analysis" /><author><name>Jeromy Anglim</name><uri>https://plus.google.com/100803004599943057656</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-xUmT1aa-RI0/AAAAAAAAAAI/AAAAAAAAAvk/eN47FjC3uVU/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://img.youtube.com/vi/fNmMgHmjU2w/default.jpg" height="72" width="72" /><thr:total>4</thr:total><feedburner:origLink>http://jeromyanglim.blogspot.com/2012/07/video-knitr-rmarkdown-rstudio.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUMMQXg4fyp7ImA9WhJRFU0.&quot;"><id>tag:blogger.com,1999:blog-8909074830238091680.post-3259543894656380636</id><published>2012-06-10T00:20:00.000+10:00</published><updated>2012-07-17T16:44:40.637+10:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-07-17T16:44:40.637+10:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="reproducible research" /><category scheme="http://www.blogger.com/atom/ns#" term="JabRef" /><category scheme="http://www.blogger.com/atom/ns#" term="LaTeX" /><category scheme="http://www.blogger.com/atom/ns#" term="Sweave" /><category scheme="http://www.blogger.com/atom/ns#" term="R" /><title>Converting Sweave LaTeX to knitr LaTeX: A case study</title><content type="html">&lt;p&gt;The following post documents the steps I needed to take in order to convert a
project using Sweave LaTeX into one using knitr LaTeX.&lt;/p&gt;

&lt;a name='more'&gt;&lt;/a&gt;

&lt;h4&gt;Additional Resources&lt;/h4&gt;

&lt;p&gt;It is fairly straightforward to convert a document from Sweave LaTeX to knitr
LaTeX. &lt;a href="http://yihui.name/"&gt;Yihui Xie&lt;/a&gt; on the knitr website provides the
following useful resources:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://yihui.name/knitr/demo/sweave/"&gt;Transition to Sweave from knitr&lt;/a&gt;: This
document describes knitr specifically from the perspective of what is the same
as Sweave and what is different from Sweave.&lt;/li&gt;
&lt;li&gt;&lt;a href="http://yihui.name/knitr/options"&gt;knitr options&lt;/a&gt;: This includes discussion of
the many R code chunk options in knitr. Many are the same as Sweave, but there
are some new ones, and some modifications.&lt;/li&gt;
&lt;li&gt;&lt;a href="http://yihui.name/knitr/demo/minimal/"&gt;knitr minimal examples&lt;/a&gt;: These are
useful for getting started with different types of knitr document including
LaTeX.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;My conversion from Sweave to knitr&lt;/h3&gt;

&lt;p&gt;The following documents the steps I needed to do in order to convert a journal
article that was in Sweave LaTeX into a knitr LaTeX document.
Most of this was documented in the above mentioned links on the knitr website,
but there were still a few little surprises.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Rnw to tex conversion&lt;/strong&gt;: Convert &lt;code&gt;R CMD Sweave myfile.rnw&lt;/code&gt; to &lt;code&gt;Rscript -e
"library(knitr); knit('myfile.nw')"&lt;/code&gt; in makefile (&lt;a href="http://stackoverflow.com/a/10943794/180892"&gt;see this SO
question&lt;/a&gt; ).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;global options&lt;/strong&gt;: Replace &lt;code&gt;\SweaveOpts{echo=FALSE}&lt;/code&gt; with
&lt;code&gt;\Sexpr{opts_chunk$set(echo=FALSE)}&lt;/code&gt;; This needed to appear before the first
R code chunk in order to affect all code chunks in the file. &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;case on R code chunk options&lt;/strong&gt;: Update &lt;code&gt;true&lt;/code&gt; and &lt;code&gt;false&lt;/code&gt; to &lt;code&gt;TRUE&lt;/code&gt; and
&lt;code&gt;FALSE&lt;/code&gt; in r code chunk options. &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;results option&lt;/strong&gt;: Update &lt;code&gt;results=tex&lt;/code&gt; to &lt;code&gt;results='asis'&lt;/code&gt; and in general ensure that text
values in R code chunks are surrounded by quotation marks.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;message option&lt;/strong&gt;: I needed to prevent the display of messages when certain
packages were loaded using &lt;code&gt;\Sexpr{opts_chunk$set(message=FALSE}}&lt;/code&gt;. &lt;br /&gt;
These messages did not previously display under sweave.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;hiding output&lt;/strong&gt;: I had some R code chunks with options &lt;code&gt;print=FALSE,
term=FALSE&lt;/code&gt;; I replaced this with &lt;code&gt;results='hide'&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;methods package&lt;/strong&gt;: I had a &lt;code&gt;densityplot()&lt;/code&gt; (i.e., a lattice plot) that
didn't display properly.  It instead showed an error: &lt;code&gt;Error using packet 1
could not find function "hasArg"&lt;/code&gt;; apparently this is caused by the fact that
the methods package doesn't load by default when using &lt;code&gt;Rscript&lt;/code&gt;; thus I
needed to put &lt;code&gt;require(methods)&lt;/code&gt; in the first R code chunk. &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Sweave.sty&lt;/strong&gt;: I removed &lt;code&gt;Sweave.sty&lt;/code&gt; from my project directory and removed
the line &lt;code&gt;\usepackage{Sweave}&lt;/code&gt; from my rnw file as both things are not needed
in knitr.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;caching&lt;/strong&gt;: Although there are packages for enabling caching, I'd never
adopted any of them. knitr makes caching very simple. I just added
&lt;code&gt;cache=TRUE&lt;/code&gt; to the global chunk options (i.e.,
&lt;code&gt;\Sexpr{opts_chunk$set(echo=FALSE, message=FALSE, cache=TRUE)}&lt;/code&gt;. This reduced
the time to build the PDF from around 5 seconds to 1 second. I'm also planning
to incorporate some Bayesian analyses with JAGS and rjags, where I'm expecting
analyses will take several minutes or longer to run. At that point, I'll
really appreciate the speed benefits of caching.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;to make or not to make&lt;/strong&gt;: I had a custom makefile on the project that kept
everything neat and tidy, copying source files into a build directory, running
all necessary commands to convert from rnw to tex and then to pdf, and then
opening the pdf in a viewer. This still works well. However, the default
"Compile to PDF" option in RStudio was also quite good (after setting tools -
options - Sweave - Weave Rnw files using knitr). In particular, I liked the
synctex support for Sweave that allows you to move from a position in the source
to the corresponding position in the PDF viewer. Also, RStudio in combination
with knitr seems to do a reasonable job of keeping the main project directory
tidy. A few auxiliary files are added, but not too many. I also appreciate the
simplicity that a simple button brings to getting started with analyses.
However, a makefile does make things more portable.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;My main conclusion from this process is that converting an ongoing Sweave LaTeX
document to knitr LaTeX is fairly straightforward, and there are a number of
useful benefits that arise. In particular, I really appreciate simple caching
and not having to worry about Sweave.sty. Great work Yihui Xie!&lt;/p&gt;

&lt;h3&gt;Additional Resources&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://feeds.feedburner.com/jeromyanglim"&gt;RSS Subscription options&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com.au/2012/06/how-to-convert-sweave-latex-to-knitr-r.html"&gt;Convert Sweave LaTEx to knitr R
Markdown&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="
http://jeromyanglim.blogspot.com.au/2012/05/getting-started-with-r-markdown-knitr.html"&gt;Getting started with R Markdown&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com.au/2009/06/learning-r-for-researchers-in.html"&gt;Getting started with R&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com.au/2010/05/videos-on-data-analysis-with-r.html"&gt;R Videos&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com.au/2010/11/makefiles-for-sweave-r-and-latex-using.html"&gt;Sweave and
makefiles&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=49K61IOOBKs:BzDgcdPFrBI:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=49K61IOOBKs:BzDgcdPFrBI:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=49K61IOOBKs:BzDgcdPFrBI:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=49K61IOOBKs:BzDgcdPFrBI:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=49K61IOOBKs:BzDgcdPFrBI:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=49K61IOOBKs:BzDgcdPFrBI:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=49K61IOOBKs:BzDgcdPFrBI:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=49K61IOOBKs:BzDgcdPFrBI:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=49K61IOOBKs:BzDgcdPFrBI:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/jeromyanglim/~4/49K61IOOBKs" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://jeromyanglim.blogspot.com/feeds/3259543894656380636/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://jeromyanglim.blogspot.com/2012/06/converting-sweave-latex-to-knitr-latex.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8909074830238091680/posts/default/3259543894656380636?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8909074830238091680/posts/default/3259543894656380636?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/jeromyanglim/~3/49K61IOOBKs/converting-sweave-latex-to-knitr-latex.html" title="Converting Sweave LaTeX to knitr LaTeX: A case study" /><author><name>Jeromy Anglim</name><uri>https://plus.google.com/100803004599943057656</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-xUmT1aa-RI0/AAAAAAAAAAI/AAAAAAAAAvk/eN47FjC3uVU/s512-c/photo.jpg" /></author><thr:total>2</thr:total><feedburner:origLink>http://jeromyanglim.blogspot.com/2012/06/converting-sweave-latex-to-knitr-latex.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEQNQHs6eSp7ImA9WhVbGEw.&quot;"><id>tag:blogger.com,1999:blog-8909074830238091680.post-1191766539870297951</id><published>2012-06-04T22:19:00.001+10:00</published><updated>2012-06-04T22:19:51.511+10:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-06-04T22:19:51.511+10:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="reproducible research" /><category scheme="http://www.blogger.com/atom/ns#" term="markup" /><category scheme="http://www.blogger.com/atom/ns#" term="Sweave" /><category scheme="http://www.blogger.com/atom/ns#" term="R" /><title>How to Convert Sweave LaTeX to knitr R Markdown: Winter Olympic Medals Example</title><content type="html">&lt;p&gt;The following post shows how to manually convert a Sweave LaTeX document into a knitr R Markdown document. The post (1) reviews many of the required changes; (2) provides an example of a document converted to R Markdown format based on an analysis of  Winter Olympic Medal data up to and including 2006; and (3) discusses the pros and cons of LaTeX and Markdown for performing analyses.&lt;/p&gt;

&lt;a name='more'&gt;&lt;/a&gt;

&lt;h1&gt;Overview&lt;/h1&gt;

&lt;p&gt;The following analyses of Winter Olympic Medals data have gone through several iterations:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;R Script&lt;/strong&gt;: I originally performed &lt;a href="http://jeromyanglim.blogspot.com.au/2010/02/analysis-of-winter-olympic-medal-data.html"&gt;similar analyses in February 2010&lt;/a&gt;. It was a simple set of commands where you could see the console output and view the plots. &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;LaTeX Sweave&lt;/strong&gt;: In February 2011 I adapted the example to make it a Sweave LaTex document. The &lt;a href="https://github.com/jeromyanglim/Sweave_Winter_Olympics"&gt;source fo this is available on github&lt;/a&gt;. With Sweave, I was able to create a document that weaved text, commands, console input, console output, and figures.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;R Markdown&lt;/strong&gt;: Now in June 2012 I&amp;#39;m using the example to review the process of converting a document from Sweave-LaTeX to R Markdown. The &lt;a href="https://github.com/jeromyanglim/Winter_Olympic_Medals_R_Markdown"&gt;souce code is available here on github&lt;/a&gt; (see the &lt;code&gt;*.rmd&lt;/code&gt; file). &lt;/li&gt;
&lt;/ol&gt;

&lt;h1&gt;Converting from Sweave to R Markdown&lt;/h1&gt;

&lt;p&gt;The following changes were required in order to convert my LaTeX Sweave document into an R Markdown document suitable for processing with &lt;code&gt;knitr&lt;/code&gt; and &lt;code&gt;RStudio&lt;/code&gt;. Many of these changes are fairly obvious if you understand LaTeX and Markdown; but a few are less obvious. And obviously there are many additional changes that might be required on other documents.&lt;/p&gt;

&lt;h2&gt;R code chunks&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;R code chunk delimiters:&lt;/strong&gt; Update  from  &lt;code&gt;&amp;lt;&amp;lt; ... &amp;gt;&amp;gt;=&lt;/code&gt; and &lt;code&gt;@&lt;/code&gt; to R markdown format &lt;code&gt;&amp;#96;&amp;#96;&amp;#96;{r ...}&lt;/code&gt; and  &lt;code&gt;&amp;#96;&amp;#96;&amp;#96;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Inline code chunks:&lt;/strong&gt; Update from &lt;code&gt;&amp;#92;Sexpr{...}&lt;/code&gt; to either &lt;code&gt;&amp;#96;r ...&amp;#96;&lt;/code&gt; or &lt;code&gt;&amp;#96;r I(...)&amp;#96;&lt;/code&gt; format.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;results=tex&lt;/strong&gt;: Any &lt;code&gt;results=tex&lt;/code&gt; needs to either be removed or converted to &lt;code&gt;results=&amp;#39;asis&amp;#39;&lt;/code&gt;. Note that string values of knitr options need to be quoted.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Boolean options&lt;/strong&gt;: Sweave tolerates lower case &lt;code&gt;true&lt;/code&gt; and &lt;code&gt;false&lt;/code&gt; for code chunk options, &lt;code&gt;knitr&lt;/code&gt; requires &lt;code&gt;TRUE&lt;/code&gt; and &lt;code&gt;FALSE&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Figures and Tables&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Floats&lt;/strong&gt;: Remove figure and table floats (e.g., &lt;code&gt;\begin{table}...\end{table}&lt;/code&gt;, &lt;code&gt;\begin{figure}...\end{figure}&lt;/code&gt;). In R Markdown and HTML, there are no pages and thus content is just placed immediately in the document.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Figure captions&lt;/strong&gt;: Extract content from within the &lt;code&gt;\caption{}&lt;/code&gt; command. When using R Markdown, it is often easiest to add captions  to the plot itself (e.g., using the &lt;code&gt;main&lt;/code&gt; argument in base graphics). &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Table captions:&lt;/strong&gt; extract content from within the &lt;code&gt;\caption{}&lt;/code&gt; command; Table captions can be included in a &lt;code&gt;caption&lt;/code&gt; argument using the &lt;code&gt;caption&lt;/code&gt; argument to the &lt;code&gt;xtable&lt;/code&gt; function (e.g., &lt;code&gt;print(xtable(MY_DAT_FRAME), &amp;quot;html&amp;quot;, caption=&amp;quot;MY CAPTION&amp;quot;, caption.placement=&amp;quot;top&amp;quot;)&lt;/code&gt; ). Caption placement defaults to &lt;code&gt;&amp;quot;bottom&amp;quot;&lt;/code&gt; of table but can be optinally specified as &lt;code&gt;&amp;quot;top&amp;quot;&lt;/code&gt; either as a global option or in &lt;code&gt;print.xtable&lt;/code&gt;. Alternatively table titles can just be included as Markdown text.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;References:&lt;/strong&gt; Delete table and figure lables (e.g., &lt;code&gt;\label{...}&lt;/code&gt;). Replace table and figure references (e.g., &lt;code&gt;\ref{...}&lt;/code&gt; with actual numbers or other descriptive terminology. It would also be possible to implement something simple in R that stored table and figure numbers (e.g., initialise table and figure numbers at the start of the document; increment table counter each time a table is created and likewise for figures; store the value of counter in variable; include variable in caption text using &lt;code&gt;paste()&lt;/code&gt; or something similar. Include counter in text using inline R code chunks.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Table content&lt;/strong&gt;: Markdown supports HTML; so one option is to convert LaTeX tables to HTML tables using a function like &lt;code&gt;print(xtable(MY_DATA_FRAME), type=&amp;quot;html&amp;quot;)&lt;/code&gt;. This is combined with the &lt;code&gt;results=&amp;#39;asis&amp;#39;&lt;/code&gt; R code chunk option.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Basic formatting&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Headings&lt;/strong&gt;: if we assume &lt;code&gt;section&lt;/code&gt; is the top level: then &lt;code&gt;\section{...}&lt;/code&gt; becomes &lt;code&gt;# ...&lt;/code&gt;,  &lt;code&gt;\subsection{...}&lt;/code&gt; becomes &lt;code&gt;## ...&lt;/code&gt; and &lt;code&gt;\subsubsection{...}&lt;/code&gt; becomes  &lt;code&gt;### ...&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Mathematics&lt;/strong&gt;: Update latex mathematics to &lt;code&gt;$&lt;/code&gt;&lt;code&gt;latex ...&lt;/code&gt; and &lt;code&gt;$$&lt;/code&gt;&lt;code&gt;latex ... $$&lt;/code&gt; notation if using RStudio.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Paragraph delimiters&lt;/strong&gt;: If using RStudio then remove single line breaks that were not intended to be paragraph breaks.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Hyperlinks&lt;/strong&gt;: Convert LaTeX Hyperlinks from &lt;code&gt;\href&lt;/code&gt; or &lt;code&gt;url&lt;/code&gt; to &lt;code&gt;[text](url)&lt;/code&gt; format.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;LaTeX things&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Comments&lt;/strong&gt;: Remove any LaTeX comments or switch from &lt;code&gt;% comment&lt;/code&gt; to &lt;code&gt;&amp;lt;!-- comment --&amp;gt;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;LaTeX escaped characters&lt;/strong&gt;: Remove unnecessary escape characters (e.g., &lt;code&gt;\%&lt;/code&gt; is just &lt;code&gt;%&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;R Markdown escaped characters&lt;/strong&gt;: Writing about the R Markdown language in R Markdown sometimes requires the use of HTML codes for special characters such as backticks (&lt;code&gt;&amp;amp;#96;&lt;/code&gt;) and backslashes (&lt;code&gt;&amp;amp;#92;&lt;/code&gt;) to prevent the text from being interpreted; see &lt;a href="http://www.ascii.cl/htmlcodes.htm"&gt;here for a list of HTML character codes&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Header&lt;/strong&gt;: Remove the LaTeX header information up to and including &lt;code&gt;\begin{document}&lt;/code&gt;; extract any incorporate any relevant content such as title, abstract, author, date, etc.&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;R Markdown Analysis of Winter Olympic Medal Data&lt;/h1&gt;

&lt;p&gt;The following shows the output of the actual analysis after running the rmd source through &lt;code&gt;Knit HTML&lt;/code&gt; in Rstudio. If you&amp;#39;re curious, you may wish to view the &lt;a href="https://github.com/jeromyanglim/Winter_Olympic_Medals_R_Markdown/blob/master/Winter_Olympics.rmd"&gt;rmd source code on GitHub side by side this point at this point&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;Import Dataset&lt;/h2&gt;

&lt;pre&gt;&lt;code class="r"&gt;library(xtable)
options(stringsAsFactors = FALSE)
medals &amp;lt;- read.csv(&amp;quot;data/medals.csv&amp;quot;)
medals$Year &amp;lt;- as.numeric(medals$Year)
medals &amp;lt;- medals[!is.na(medals$Year), ]
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The Olympic Medals data frame includes &lt;code&gt;2311&lt;/code&gt; medals from &lt;code&gt;1924&lt;/code&gt; to  &lt;code&gt;2006&lt;/code&gt;.  The data was sourced from &lt;a href="http://www.guardian.co.uk/news/datablog/2010/feb/11/winter-olympics-medals-by-country"&gt;The Guardian Data Blog&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;Total Medals by Year&lt;/h2&gt;

&lt;pre&gt;&lt;code class="r"&gt;# http://www.math.mcmaster.ca/~bolker/emdbook/chap3A.pdf
x &amp;lt;- aggregate(medals$Year, list(Year = medals$Year), length)
names(x) &amp;lt;- c(&amp;quot;year&amp;quot;, &amp;quot;medals&amp;quot;)
x$pos &amp;lt;- seq(x$year)
fit &amp;lt;- nls(medals ~ a * pos^b + c, x, start = list(a = 10, b = 1, 
    c = 50))
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;In general over the years the number of Winter Olympic medals awarded has increased.  In order to model this relationship, year was converted to ordinal position.  A three parameter power function seemed plausible, \(  y = ax^b + c \), where \(  y \) is total medals awarded and \(  x \) is the ordinal position of the olympics starting at one.  The best fitting parameters by least-squares were&lt;/p&gt;

&lt;p&gt;\[  
0.202 
x^{2.297 + 50.987}.
 \]&lt;/p&gt;

&lt;p&gt;The figure displays the data and the line of best fit for the model. The model predicts that 2010, 2014, and 2018 would have  &lt;code&gt;271&lt;/code&gt;,  &lt;code&gt;295&lt;/code&gt;, and &lt;code&gt;322&lt;/code&gt; medals  respectively.&lt;/p&gt;

&lt;pre&gt;&lt;code class="r"&gt;plot(medals ~ pos, x,  las = 1, 
        ylab = &amp;quot;Total Medals Awarded&amp;quot;, 
        xlab = &amp;quot;Ordinal Position of Olympics&amp;quot;,
        main=&amp;quot;Total medals awarded 
     by ordinal position of Olympics with
     predicted three parameter power function fit displayed.&amp;quot;,
        las = 1,
        bty=&amp;quot;l&amp;quot;)
lines(x$pos, predict(fit))
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;img src="http://i.imgur.com/atTmh.png" alt="plot of chunk figure_of_medals"/&gt; &lt;/p&gt;

&lt;h1&gt;Gender Ratio by Year&lt;/h1&gt;

&lt;pre&gt;&lt;code class="r"&gt;medalsByYearByGender &amp;lt;- aggregate(medals$Year, list(Year = medals$Year, 
    Event.gender = medals$Event.gender), length)
medalsByYearByGender &amp;lt;- medalsByYearByGender[medalsByYearByGender$Event.gender != 
    &amp;quot;X&amp;quot;, ]
propf &amp;lt;- list()
propf$prop &amp;lt;- medalsByYearByGender[medalsByYearByGender$Event.gender == 
    &amp;quot;W&amp;quot;, &amp;quot;x&amp;quot;]/(medalsByYearByGender[medalsByYearByGender$Event.gender == &amp;quot;W&amp;quot;, 
    &amp;quot;x&amp;quot;] + medalsByYearByGender[medalsByYearByGender$Event.gender == &amp;quot;M&amp;quot;, &amp;quot;x&amp;quot;])
propf$year &amp;lt;- medalsByYearByGender[medalsByYearByGender$Event.gender == 
    &amp;quot;W&amp;quot;, &amp;quot;Year&amp;quot;]
propf$propF &amp;lt;- format(round(propf$prop, 2))

propf$table &amp;lt;- with(propf, cbind(year, propF))
colnames(propf$table) &amp;lt;- c(&amp;quot;Year&amp;quot;, &amp;quot;Prop. Female&amp;quot;)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The figure shows the number of medals won by males and  females by year. The table shows the proportion of medals awarded to females by year. It shows a generally similar pattern for males and females. Medals increase gradually until around the late 1980s after which the rate of increase accelerates. However, females started from a much smaller base. Thus, both the absolute difference and the percentage difference has decreased over time to the point where in 2006 &lt;code&gt;46&lt;/code&gt; of medals were won by females.&lt;/p&gt;

&lt;pre&gt;&lt;code class="r"&gt;plot(x ~ Year, medalsByYearByGender[medalsByYearByGender$Event.gender == 
    &amp;quot;M&amp;quot;, ], ylim = c(0, max(x)), pch = &amp;quot;m&amp;quot;, col = &amp;quot;blue&amp;quot;, las = 1, ylab = &amp;quot;Total Medals Awarded&amp;quot;, 
    bty = &amp;quot;l&amp;quot;, main = &amp;quot;Total Medals Won by Gender and Year&amp;quot;)
points(medalsByYearByGender[medalsByYearByGender$Event.gender == 
    &amp;quot;W&amp;quot;, &amp;quot;Year&amp;quot;], medalsByYearByGender[medalsByYearByGender$Event.gender == 
    &amp;quot;W&amp;quot;, &amp;quot;x&amp;quot;], col = &amp;quot;red&amp;quot;, pch = &amp;quot;f&amp;quot;)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;img src="http://i.imgur.com/idGC7.png" alt="plot of chunk fgenderRatioByYear_figure"/&gt; &lt;/p&gt;

&lt;pre&gt;&lt;code class="r"&gt;print(xtable(propf$table,
             caption=&amp;quot;Proportion of Medals that were awarded to Females by Year&amp;quot;), 
      type=&amp;quot;html&amp;quot;, 
      caption.placement=&amp;quot;top&amp;quot;,
      html.table.attributes=&amp;#39;align=&amp;quot;center&amp;quot;&amp;#39;)
&lt;/code&gt;&lt;/pre&gt;

&lt;!-- html table generated in R 2.15.0 by xtable 1.7-0 package --&gt;

&lt;!-- Mon Jun  4 22:14:27 2012 --&gt;

&lt;TABLE align="center"&gt;
&lt;CAPTION ALIGN="top"&gt; Proportion of Medals that were awarded to Females by Year &lt;/CAPTION&gt;
&lt;TR&gt; &lt;TH&gt;  &lt;/TH&gt; &lt;TH&gt; Year &lt;/TH&gt; &lt;TH&gt; Prop. Female &lt;/TH&gt;  &lt;/TR&gt;
  &lt;TR&gt; &lt;TD align="right"&gt; 1 &lt;/TD&gt; &lt;TD&gt; 1924 &lt;/TD&gt; &lt;TD&gt; 0.07 &lt;/TD&gt; &lt;/TR&gt;
  &lt;TR&gt; &lt;TD align="right"&gt; 2 &lt;/TD&gt; &lt;TD&gt; 1928 &lt;/TD&gt; &lt;TD&gt; 0.08 &lt;/TD&gt; &lt;/TR&gt;
  &lt;TR&gt; &lt;TD align="right"&gt; 3 &lt;/TD&gt; &lt;TD&gt; 1932 &lt;/TD&gt; &lt;TD&gt; 0.08 &lt;/TD&gt; &lt;/TR&gt;
  &lt;TR&gt; &lt;TD align="right"&gt; 4 &lt;/TD&gt; &lt;TD&gt; 1936 &lt;/TD&gt; &lt;TD&gt; 0.12 &lt;/TD&gt; &lt;/TR&gt;
  &lt;TR&gt; &lt;TD align="right"&gt; 5 &lt;/TD&gt; &lt;TD&gt; 1948 &lt;/TD&gt; &lt;TD&gt; 0.18 &lt;/TD&gt; &lt;/TR&gt;
  &lt;TR&gt; &lt;TD align="right"&gt; 6 &lt;/TD&gt; &lt;TD&gt; 1952 &lt;/TD&gt; &lt;TD&gt; 0.23 &lt;/TD&gt; &lt;/TR&gt;
  &lt;TR&gt; &lt;TD align="right"&gt; 7 &lt;/TD&gt; &lt;TD&gt; 1956 &lt;/TD&gt; &lt;TD&gt; 0.26 &lt;/TD&gt; &lt;/TR&gt;
  &lt;TR&gt; &lt;TD align="right"&gt; 8 &lt;/TD&gt; &lt;TD&gt; 1960 &lt;/TD&gt; &lt;TD&gt; 0.38 &lt;/TD&gt; &lt;/TR&gt;
  &lt;TR&gt; &lt;TD align="right"&gt; 9 &lt;/TD&gt; &lt;TD&gt; 1964 &lt;/TD&gt; &lt;TD&gt; 0.37 &lt;/TD&gt; &lt;/TR&gt;
  &lt;TR&gt; &lt;TD align="right"&gt; 10 &lt;/TD&gt; &lt;TD&gt; 1968 &lt;/TD&gt; &lt;TD&gt; 0.37 &lt;/TD&gt; &lt;/TR&gt;
  &lt;TR&gt; &lt;TD align="right"&gt; 11 &lt;/TD&gt; &lt;TD&gt; 1972 &lt;/TD&gt; &lt;TD&gt; 0.36 &lt;/TD&gt; &lt;/TR&gt;
  &lt;TR&gt; &lt;TD align="right"&gt; 12 &lt;/TD&gt; &lt;TD&gt; 1976 &lt;/TD&gt; &lt;TD&gt; 0.35 &lt;/TD&gt; &lt;/TR&gt;
  &lt;TR&gt; &lt;TD align="right"&gt; 13 &lt;/TD&gt; &lt;TD&gt; 1980 &lt;/TD&gt; &lt;TD&gt; 0.34 &lt;/TD&gt; &lt;/TR&gt;
  &lt;TR&gt; &lt;TD align="right"&gt; 14 &lt;/TD&gt; &lt;TD&gt; 1984 &lt;/TD&gt; &lt;TD&gt; 0.36 &lt;/TD&gt; &lt;/TR&gt;
  &lt;TR&gt; &lt;TD align="right"&gt; 15 &lt;/TD&gt; &lt;TD&gt; 1988 &lt;/TD&gt; &lt;TD&gt; 0.37 &lt;/TD&gt; &lt;/TR&gt;
  &lt;TR&gt; &lt;TD align="right"&gt; 16 &lt;/TD&gt; &lt;TD&gt; 1992 &lt;/TD&gt; &lt;TD&gt; 0.43 &lt;/TD&gt; &lt;/TR&gt;
  &lt;TR&gt; &lt;TD align="right"&gt; 17 &lt;/TD&gt; &lt;TD&gt; 1994 &lt;/TD&gt; &lt;TD&gt; 0.43 &lt;/TD&gt; &lt;/TR&gt;
  &lt;TR&gt; &lt;TD align="right"&gt; 18 &lt;/TD&gt; &lt;TD&gt; 1998 &lt;/TD&gt; &lt;TD&gt; 0.44 &lt;/TD&gt; &lt;/TR&gt;
  &lt;TR&gt; &lt;TD align="right"&gt; 19 &lt;/TD&gt; &lt;TD&gt; 2002 &lt;/TD&gt; &lt;TD&gt; 0.45 &lt;/TD&gt; &lt;/TR&gt;
  &lt;TR&gt; &lt;TD align="right"&gt; 20 &lt;/TD&gt; &lt;TD&gt; 2006 &lt;/TD&gt; &lt;TD&gt; 0.46 &lt;/TD&gt; &lt;/TR&gt;
   &lt;/TABLE&gt;

&lt;h1&gt;Countries with the Most Medals&lt;/h1&gt;

&lt;pre&gt;&lt;code class="r"&gt;cmm &amp;lt;- list()
cmm$medals &amp;lt;- sort(table(medals$NOC), dec = TRUE)
cmm$country &amp;lt;- names(cmm$medals)
cmm$prop &amp;lt;- cmm$medals/sum(cmm$medals)
cmm$propF &amp;lt;- paste(round(cmm$prop * 100, 2), &amp;quot;%&amp;quot;, sep = &amp;quot;&amp;quot;)

cmm$row1 &amp;lt;- c(&amp;quot;Rank&amp;quot;, &amp;quot;Country&amp;quot;, &amp;quot;Total&amp;quot;, &amp;quot;%&amp;quot;)
cmm$rank &amp;lt;- seq(cmm$medals)
cmm$include &amp;lt;- 1:10

cmm$table &amp;lt;- with(cmm, rbind(cbind(rank[include], country[include], 
    medals[include], propF[include])))
colnames(cmm$table) &amp;lt;- cmm$row1
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Norway has won the most medals with &lt;code&gt;280&lt;/code&gt; (&lt;code&gt;12.12&lt;/code&gt;%). The table shows the top 10.  Russia, USSR, and EUN (Unified Team in 1992 Olympics) have a combined total of &lt;code&gt;293&lt;/code&gt;.  Germany, GDR, and FRG have a combined medal total of  &lt;code&gt;309&lt;/code&gt;.&lt;/p&gt;

&lt;pre&gt;&lt;code class="r"&gt;print(xtable(cmm$table, caption=&amp;quot;Rankings of Medals Won by Country&amp;quot;), 
      &amp;quot;html&amp;quot;, include.rownames=FALSE, caption.placement=&amp;#39;top&amp;#39;,
      html.table.attributes=&amp;#39;align=&amp;quot;center&amp;quot;&amp;#39;)
&lt;/code&gt;&lt;/pre&gt;

&lt;!-- html table generated in R 2.15.0 by xtable 1.7-0 package --&gt;

&lt;!-- Mon Jun  4 22:14:27 2012 --&gt;

&lt;TABLE align="center"&gt;
&lt;CAPTION ALIGN="top"&gt; Rankings of Medals Won by Country &lt;/CAPTION&gt;
&lt;TR&gt; &lt;TH&gt; Rank &lt;/TH&gt; &lt;TH&gt; Country &lt;/TH&gt; &lt;TH&gt; Total &lt;/TH&gt; &lt;TH&gt; % &lt;/TH&gt;  &lt;/TR&gt;
  &lt;TR&gt; &lt;TD&gt; 1 &lt;/TD&gt; &lt;TD&gt; NOR &lt;/TD&gt; &lt;TD&gt; 280 &lt;/TD&gt; &lt;TD&gt; 12.12% &lt;/TD&gt; &lt;/TR&gt;
  &lt;TR&gt; &lt;TD&gt; 2 &lt;/TD&gt; &lt;TD&gt; USA &lt;/TD&gt; &lt;TD&gt; 216 &lt;/TD&gt; &lt;TD&gt; 9.35% &lt;/TD&gt; &lt;/TR&gt;
  &lt;TR&gt; &lt;TD&gt; 3 &lt;/TD&gt; &lt;TD&gt; URS &lt;/TD&gt; &lt;TD&gt; 194 &lt;/TD&gt; &lt;TD&gt; 8.39% &lt;/TD&gt; &lt;/TR&gt;
  &lt;TR&gt; &lt;TD&gt; 4 &lt;/TD&gt; &lt;TD&gt; AUT &lt;/TD&gt; &lt;TD&gt; 185 &lt;/TD&gt; &lt;TD&gt; 8.01% &lt;/TD&gt; &lt;/TR&gt;
  &lt;TR&gt; &lt;TD&gt; 5 &lt;/TD&gt; &lt;TD&gt; GER &lt;/TD&gt; &lt;TD&gt; 158 &lt;/TD&gt; &lt;TD&gt; 6.84% &lt;/TD&gt; &lt;/TR&gt;
  &lt;TR&gt; &lt;TD&gt; 6 &lt;/TD&gt; &lt;TD&gt; FIN &lt;/TD&gt; &lt;TD&gt; 151 &lt;/TD&gt; &lt;TD&gt; 6.53% &lt;/TD&gt; &lt;/TR&gt;
  &lt;TR&gt; &lt;TD&gt; 7 &lt;/TD&gt; &lt;TD&gt; CAN &lt;/TD&gt; &lt;TD&gt; 119 &lt;/TD&gt; &lt;TD&gt; 5.15% &lt;/TD&gt; &lt;/TR&gt;
  &lt;TR&gt; &lt;TD&gt; 8 &lt;/TD&gt; &lt;TD&gt; SUI &lt;/TD&gt; &lt;TD&gt; 118 &lt;/TD&gt; &lt;TD&gt; 5.11% &lt;/TD&gt; &lt;/TR&gt;
  &lt;TR&gt; &lt;TD&gt; 9 &lt;/TD&gt; &lt;TD&gt; SWE &lt;/TD&gt; &lt;TD&gt; 118 &lt;/TD&gt; &lt;TD&gt; 5.11% &lt;/TD&gt; &lt;/TR&gt;
  &lt;TR&gt; &lt;TD&gt; 10 &lt;/TD&gt; &lt;TD&gt; GDR &lt;/TD&gt; &lt;TD&gt; 110 &lt;/TD&gt; &lt;TD&gt; 4.76% &lt;/TD&gt; &lt;/TR&gt;
   &lt;/TABLE&gt;

&lt;h1&gt;Proportion of Gold Medals by Country&lt;/h1&gt;

&lt;p&gt;Looking only at countries that have won more than 50 medals in the dataset, the figure shows that the proportion of medals won that were gold, silver, or bronze.&lt;/p&gt;

&lt;pre&gt;&lt;code class="r"&gt;NOC50Plus &amp;lt;- names(table(medals$NOC)[table(medals$NOC) &amp;gt; 50])
medalsSubset &amp;lt;- medals[medals$NOC %in% NOC50Plus, ]
medalsByMedalByNOC &amp;lt;- prop.table(table(medalsSubset$NOC, medalsSubset$Medal), 
                                 margin = 1)
medalsByMedalByNOC &amp;lt;- medalsByMedalByNOC[order(medalsByMedalByNOC[, &amp;quot;Gold&amp;quot;], 
         decreasing = TRUE), c(&amp;quot;Gold&amp;quot;, &amp;quot;Silver&amp;quot;, &amp;quot;Bronze&amp;quot;)]
barplot(round(t(medalsByMedalByNOC), 2), horiz = TRUE, las = 1, 
        col=c(&amp;quot;gold&amp;quot;, &amp;quot;grey71&amp;quot;, &amp;quot;chocolate4&amp;quot;), 
        xlab = &amp;quot;Proportion of Medals&amp;quot;,
        main=&amp;quot;Proportion of medals won that were gold, silver or bronze.&amp;quot;)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;img src="http://i.imgur.com/L7f1C.png" alt="plot of chunk proportion_gold"/&gt; &lt;/p&gt;

&lt;h1&gt;How many different countries have won medals by year?&lt;/h1&gt;

&lt;pre&gt;&lt;code class="r"&gt;listOfYears &amp;lt;- unique(medals$Year)
names(listOfYears) &amp;lt;- unique(medals$Year)
totalNocByYear &amp;lt;- sapply(listOfYears, function(X) length(table(medals[medals$Year == 
    X, &amp;quot;NOC&amp;quot;])))
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The figure shows the total number of countries winning medals by year.&lt;/p&gt;

&lt;pre&gt;&lt;code class="r"&gt;plot(x = names(totalNocByYear), totalNocByYear, ylim = c(0, max(totalNocByYear)), 
    las = 1, xlab = &amp;quot;Year&amp;quot;, main = &amp;quot;Total Number of Countries Winning Medals By Year&amp;quot;, 
    ylab = &amp;quot;Total Number of Countries&amp;quot;, bty = &amp;quot;l&amp;quot;)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;img src="http://i.imgur.com/VKzmi.png" alt="plot of chunk figure_total_medals"/&gt; &lt;/p&gt;

&lt;h1&gt;Australia at the Winter Olympics&lt;/h1&gt;

&lt;pre&gt;&lt;code class="r"&gt;ausmedals &amp;lt;- list()
ausmedals$data &amp;lt;- medals[medals$NOC == &amp;quot;AUS&amp;quot;, ]
ausmedals$data &amp;lt;- ausmedals$data[, c(&amp;quot;Year&amp;quot;, &amp;quot;City&amp;quot;, &amp;quot;Discipline&amp;quot;, 
    &amp;quot;Event&amp;quot;, &amp;quot;Medal&amp;quot;)]
ausmedals$table &amp;lt;- ausmedals$data
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Given that I am an Australian I decided to have a look at the Australian medal count. Australia does not get a lot of snow.  Up to and including 2006, Australia has won  &lt;code&gt;6&lt;/code&gt; medals. It won its first medal in  &lt;code&gt;1994&lt;/code&gt;. Of the &lt;code&gt;6&lt;/code&gt; medals,  &lt;code&gt;3&lt;/code&gt; were bronze, &lt;code&gt;0&lt;/code&gt; were silver, and &lt;code&gt;3&lt;/code&gt; were gold.  The table lists each of these medals.&lt;/p&gt;

&lt;pre&gt;&lt;code class="r"&gt;print(xtable(ausmedals$table, 
             caption=&amp;#39;List of Australian Medals&amp;#39;,
             digits=0),
      type=&amp;#39;html&amp;#39;, 
      caption.placement=&amp;#39;top&amp;#39;, 
      include.rownames=FALSE,
      html.table.attributes=&amp;#39;align=&amp;quot;center&amp;quot;&amp;#39;) 
&lt;/code&gt;&lt;/pre&gt;

&lt;!-- html table generated in R 2.15.0 by xtable 1.7-0 package --&gt;

&lt;!-- Mon Jun  4 22:15:10 2012 --&gt;

&lt;TABLE align="center"&gt;
&lt;CAPTION ALIGN="top"&gt; List of Australian Medals &lt;/CAPTION&gt;
&lt;TR&gt; &lt;TH&gt; Year &lt;/TH&gt; &lt;TH&gt; City &lt;/TH&gt; &lt;TH&gt; Discipline &lt;/TH&gt; &lt;TH&gt; Event &lt;/TH&gt; &lt;TH&gt; Medal &lt;/TH&gt;  &lt;/TR&gt;
  &lt;TR&gt; &lt;TD align="right"&gt; 1994 &lt;/TD&gt; &lt;TD&gt; Lillehammer &lt;/TD&gt; &lt;TD&gt; Short Track S. &lt;/TD&gt; &lt;TD&gt; 5000m relay &lt;/TD&gt; &lt;TD&gt; Bronze &lt;/TD&gt; &lt;/TR&gt;
  &lt;TR&gt; &lt;TD align="right"&gt; 1998 &lt;/TD&gt; &lt;TD&gt; Nagano &lt;/TD&gt; &lt;TD&gt; Alpine Skiing &lt;/TD&gt; &lt;TD&gt; slalom &lt;/TD&gt; &lt;TD&gt; Bronze &lt;/TD&gt; &lt;/TR&gt;
  &lt;TR&gt; &lt;TD align="right"&gt; 2002 &lt;/TD&gt; &lt;TD&gt; Salt Lake City &lt;/TD&gt; &lt;TD&gt; Short Track S. &lt;/TD&gt; &lt;TD&gt; 1000m &lt;/TD&gt; &lt;TD&gt; Gold &lt;/TD&gt; &lt;/TR&gt;
  &lt;TR&gt; &lt;TD align="right"&gt; 2002 &lt;/TD&gt; &lt;TD&gt; Salt Lake City &lt;/TD&gt; &lt;TD&gt; Freestyle Ski. &lt;/TD&gt; &lt;TD&gt; aerials &lt;/TD&gt; &lt;TD&gt; Gold &lt;/TD&gt; &lt;/TR&gt;
  &lt;TR&gt; &lt;TD align="right"&gt; 2006 &lt;/TD&gt; &lt;TD&gt; Turin &lt;/TD&gt; &lt;TD&gt; Freestyle Ski. &lt;/TD&gt; &lt;TD&gt; aerials &lt;/TD&gt; &lt;TD&gt; Bronze &lt;/TD&gt; &lt;/TR&gt;
  &lt;TR&gt; &lt;TD align="right"&gt; 2006 &lt;/TD&gt; &lt;TD&gt; Turin &lt;/TD&gt; &lt;TD&gt; Freestyle Ski. &lt;/TD&gt; &lt;TD&gt; moguls &lt;/TD&gt; &lt;TD&gt; Gold &lt;/TD&gt; &lt;/TR&gt;
   &lt;/TABLE&gt;

&lt;h1&gt;Ice Hockey&lt;/h1&gt;

&lt;pre&gt;&lt;code class="r"&gt;icehockey &amp;lt;- medals[medals$Sport == &amp;quot;Ice Hockey&amp;quot; &amp;amp; medals$Event.gender == 
    &amp;quot;M&amp;quot; &amp;amp; medals$Medal == &amp;quot;Gold&amp;quot;, ]
icehockeyf &amp;lt;- medals[medals$Sport == &amp;quot;Ice Hockey&amp;quot; &amp;amp; medals$Event.gender == 
    &amp;quot;W&amp;quot; &amp;amp; medals$Medal == &amp;quot;Gold&amp;quot;, ]

# names(table(icehockey$NOC)[table(icehockey$NOC) &amp;gt; 1])
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The following are some statistics about Winter Olympics Ice Hockey up to and including the 2006 Winter Olympics.  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Out of the  &lt;code&gt;20&lt;/code&gt;  Winter Olympics that have been staged,  Mens Ice Hockey has been held in  &lt;code&gt;20&lt;/code&gt; and the Womens in &lt;code&gt;3&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The USSR has won the most mens gold medals with &lt;code&gt;7&lt;/code&gt; golds. It goes up to &lt;code&gt;8&lt;/code&gt; if the 1992 Unified Team is included. &lt;/li&gt;
&lt;li&gt;Canada has the second most golds with  &lt;code&gt;6&lt;/code&gt;. &lt;/li&gt;
&lt;li&gt;After that the only two nations to win more than one gold are  Sweden (&lt;code&gt;2&lt;/code&gt; golds) and the United States (&lt;code&gt;2&lt;/code&gt; golds).&lt;/li&gt;
&lt;li&gt; The  table shows the countries who won gold and silver medals by year.&lt;/li&gt;
&lt;li&gt;In the case of the Women&amp;#39;s Ice Hockey, Canada has won &lt;code&gt;2&lt;/code&gt; and the United States has won &lt;code&gt;1&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;pre&gt;&lt;code class="r"&gt;icehockeygs &amp;lt;- medals[medals$Sport == &amp;quot;Ice Hockey&amp;quot; &amp;amp; 
    medals$Event.gender == &amp;quot;M&amp;quot; &amp;amp;
    medals$Medal %in% c(&amp;quot;Silver&amp;quot;, &amp;quot;Gold&amp;quot;),  c(&amp;quot;Year&amp;quot;, &amp;quot;Medal&amp;quot;, &amp;quot;NOC&amp;quot;)]
icetab &amp;lt;- list()
icetab$data &amp;lt;- reshape(icehockeygs, idvar=&amp;quot;Year&amp;quot;, timevar=&amp;quot;Medal&amp;quot;,
    direction=&amp;quot;wide&amp;quot;)
names(icetab$data) &amp;lt;- c(&amp;quot;Year&amp;quot;, &amp;quot;Gold&amp;quot;, &amp;quot;Silver&amp;quot;)

print(xtable(icetab$data, 
             caption =&amp;quot;Country Winning Gold and Silver Medals by Year in Mens Ice Hockey&amp;quot;, 
             digits=0), 
      type=&amp;quot;html&amp;quot;,     
      include.rownames=FALSE,
      caption.placement=&amp;quot;top&amp;quot;,
      html.table.attributes=&amp;#39;align=&amp;quot;center&amp;quot;&amp;#39;)
&lt;/code&gt;&lt;/pre&gt;

&lt;!-- html table generated in R 2.15.0 by xtable 1.7-0 package --&gt;

&lt;!-- Mon Jun  4 22:15:10 2012 --&gt;

&lt;TABLE align="center"&gt;
&lt;CAPTION ALIGN="top"&gt; Country Winning Gold and Silver Medals by Year in Mens Ice Hockey &lt;/CAPTION&gt;
&lt;TR&gt; &lt;TH&gt; Year &lt;/TH&gt; &lt;TH&gt; Gold &lt;/TH&gt; &lt;TH&gt; Silver &lt;/TH&gt;  &lt;/TR&gt;
  &lt;TR&gt; &lt;TD align="right"&gt; 1924 &lt;/TD&gt; &lt;TD&gt; CAN &lt;/TD&gt; &lt;TD&gt; USA &lt;/TD&gt; &lt;/TR&gt;
  &lt;TR&gt; &lt;TD align="right"&gt; 1928 &lt;/TD&gt; &lt;TD&gt; CAN &lt;/TD&gt; &lt;TD&gt; SWE &lt;/TD&gt; &lt;/TR&gt;
  &lt;TR&gt; &lt;TD align="right"&gt; 1932 &lt;/TD&gt; &lt;TD&gt; CAN &lt;/TD&gt; &lt;TD&gt; USA &lt;/TD&gt; &lt;/TR&gt;
  &lt;TR&gt; &lt;TD align="right"&gt; 1936 &lt;/TD&gt; &lt;TD&gt; GBR &lt;/TD&gt; &lt;TD&gt; CAN &lt;/TD&gt; &lt;/TR&gt;
  &lt;TR&gt; &lt;TD align="right"&gt; 1948 &lt;/TD&gt; &lt;TD&gt; CAN &lt;/TD&gt; &lt;TD&gt; TCH &lt;/TD&gt; &lt;/TR&gt;
  &lt;TR&gt; &lt;TD align="right"&gt; 1952 &lt;/TD&gt; &lt;TD&gt; CAN &lt;/TD&gt; &lt;TD&gt; USA &lt;/TD&gt; &lt;/TR&gt;
  &lt;TR&gt; &lt;TD align="right"&gt; 1956 &lt;/TD&gt; &lt;TD&gt; URS &lt;/TD&gt; &lt;TD&gt; USA &lt;/TD&gt; &lt;/TR&gt;
  &lt;TR&gt; &lt;TD align="right"&gt; 1960 &lt;/TD&gt; &lt;TD&gt; USA &lt;/TD&gt; &lt;TD&gt; CAN &lt;/TD&gt; &lt;/TR&gt;
  &lt;TR&gt; &lt;TD align="right"&gt; 1964 &lt;/TD&gt; &lt;TD&gt; URS &lt;/TD&gt; &lt;TD&gt; SWE &lt;/TD&gt; &lt;/TR&gt;
  &lt;TR&gt; &lt;TD align="right"&gt; 1968 &lt;/TD&gt; &lt;TD&gt; URS &lt;/TD&gt; &lt;TD&gt; TCH &lt;/TD&gt; &lt;/TR&gt;
  &lt;TR&gt; &lt;TD align="right"&gt; 1972 &lt;/TD&gt; &lt;TD&gt; URS &lt;/TD&gt; &lt;TD&gt; USA &lt;/TD&gt; &lt;/TR&gt;
  &lt;TR&gt; &lt;TD align="right"&gt; 1976 &lt;/TD&gt; &lt;TD&gt; URS &lt;/TD&gt; &lt;TD&gt; TCH &lt;/TD&gt; &lt;/TR&gt;
  &lt;TR&gt; &lt;TD align="right"&gt; 1980 &lt;/TD&gt; &lt;TD&gt; USA &lt;/TD&gt; &lt;TD&gt; URS &lt;/TD&gt; &lt;/TR&gt;
  &lt;TR&gt; &lt;TD align="right"&gt; 1984 &lt;/TD&gt; &lt;TD&gt; URS &lt;/TD&gt; &lt;TD&gt; TCH &lt;/TD&gt; &lt;/TR&gt;
  &lt;TR&gt; &lt;TD align="right"&gt; 1988 &lt;/TD&gt; &lt;TD&gt; URS &lt;/TD&gt; &lt;TD&gt; FIN &lt;/TD&gt; &lt;/TR&gt;
  &lt;TR&gt; &lt;TD align="right"&gt; 1992 &lt;/TD&gt; &lt;TD&gt; EUN &lt;/TD&gt; &lt;TD&gt; CAN &lt;/TD&gt; &lt;/TR&gt;
  &lt;TR&gt; &lt;TD align="right"&gt; 1994 &lt;/TD&gt; &lt;TD&gt; SWE &lt;/TD&gt; &lt;TD&gt; CAN &lt;/TD&gt; &lt;/TR&gt;
  &lt;TR&gt; &lt;TD align="right"&gt; 1998 &lt;/TD&gt; &lt;TD&gt; CZE &lt;/TD&gt; &lt;TD&gt; RUS &lt;/TD&gt; &lt;/TR&gt;
  &lt;TR&gt; &lt;TD align="right"&gt; 2002 &lt;/TD&gt; &lt;TD&gt; CAN &lt;/TD&gt; &lt;TD&gt; USA &lt;/TD&gt; &lt;/TR&gt;
  &lt;TR&gt; &lt;TD align="right"&gt; 2006 &lt;/TD&gt; &lt;TD&gt; SWE &lt;/TD&gt; &lt;TD&gt; FIN &lt;/TD&gt; &lt;/TR&gt;
   &lt;/TABLE&gt;

&lt;h1&gt;Reflections on the Conversion Process&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;Markdown versus LaTeX: 

&lt;ul&gt;
&lt;li&gt;I prefer performing analyses with Markdown than I do with LateX. &lt;/li&gt;
&lt;li&gt;Markdown is easier to type than LaTeX. &lt;/li&gt;
&lt;li&gt;Markdown is easier to read than LaTeX.&lt;/li&gt;
&lt;li&gt;It is easier with Markdown to get started with analyses.&lt;/li&gt;
&lt;li&gt;Many analyses are only presented on the screen and as such page breaks in LaTeX are a nuisance. This extends to many features of LaTeX such as headers, figure and table placement, margins, table formatting, partiuclarly for long or wide tables, and so on.&lt;/li&gt;
&lt;li&gt;That said, journal articles, books, and other artefacts that are bound to the model of a printed page are not going anywhere. &lt;/li&gt;
&lt;li&gt;Furthermore, bibliographies, cross-references, elaborate control of table appearance, and more are all features which LaTeX makes easier than Markdown.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;R Markdown to Sweave LaTeX:

&lt;ul&gt;
&lt;li&gt;The more common conversion task that I can imagine is taking some simple analyses in R Markdown and having to convert them into knitr LaTeX in order to include the content in a journal article.&lt;/li&gt;
&lt;li&gt;The first time I converted between the formats, it was good to do it in a relatively manual way to get a sense of all the required changes; however, if I had a large document or was doing the task on subsequent occasions, I would look at more automated solutions using string replacement tools (e.g., sed, or even just replacement commands in a text editor such as Vim), and markup conversion tools (e.g., pandoc).&lt;/li&gt;
&lt;li&gt;Perhaps if the formats get popular enough, developers will start to build dedicated conversion tools.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;Additional Resources&lt;/h1&gt;

&lt;p&gt;If you liked this post, you may want to subscribe to the &lt;a href="http://feeds.feedburner.com/jeromyanglim"&gt;RSS feed of my blog&lt;/a&gt;. Also see:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;This post on &lt;a href="http://jeromyanglim.blogspot.com/2012/05/getting-started-with-r-markdown-knitr.html"&gt;Getting Started with R Markdown, knitr, and Rstudio 0.96&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;This post for another &lt;a href="http://jeromyanglim.blogspot.com/2012/05/example-reproducile-report-using-r.html"&gt;Example Reproducible Report using R Markdown which analyses California Schools Test Data&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;These &lt;a href="http://jeromyanglim.blogspot.com.au/search/label/Sweave"&gt;Assorted posts using Sweave&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;The &lt;a href="http://yihui.name/knitr/"&gt;knitr&lt;/a&gt; home page and &lt;a href="http://yihui.name/knitr/options"&gt;knitr options page&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;the &lt;a href="http://cran.r-project.org/web/packages/xtable/vignettes/xtableGallery.pdf"&gt;xtable LaTeX table gallery&lt;/a&gt; which can also be used to generate HTML tables for inclusion in Markdown.&lt;/li&gt;
&lt;/ul&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=ZTvGTPhBBDI:xAjeBEo7Jtw:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=ZTvGTPhBBDI:xAjeBEo7Jtw:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=ZTvGTPhBBDI:xAjeBEo7Jtw:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=ZTvGTPhBBDI:xAjeBEo7Jtw:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=ZTvGTPhBBDI:xAjeBEo7Jtw:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=ZTvGTPhBBDI:xAjeBEo7Jtw:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=ZTvGTPhBBDI:xAjeBEo7Jtw:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=ZTvGTPhBBDI:xAjeBEo7Jtw:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=ZTvGTPhBBDI:xAjeBEo7Jtw:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/jeromyanglim/~4/ZTvGTPhBBDI" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://jeromyanglim.blogspot.com/feeds/1191766539870297951/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://jeromyanglim.blogspot.com/2012/06/how-to-convert-sweave-latex-to-knitr-r.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8909074830238091680/posts/default/1191766539870297951?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8909074830238091680/posts/default/1191766539870297951?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/jeromyanglim/~3/ZTvGTPhBBDI/how-to-convert-sweave-latex-to-knitr-r.html" title="How to Convert Sweave LaTeX to knitr R Markdown: Winter Olympic Medals Example" /><author><name>Jeromy Anglim</name><uri>https://plus.google.com/100803004599943057656</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-xUmT1aa-RI0/AAAAAAAAAAI/AAAAAAAAAvk/eN47FjC3uVU/s512-c/photo.jpg" /></author><thr:total>2</thr:total><feedburner:origLink>http://jeromyanglim.blogspot.com/2012/06/how-to-convert-sweave-latex-to-knitr-r.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkUNQHg9eip7ImA9WhVUFE0.&quot;"><id>tag:blogger.com,1999:blog-8909074830238091680.post-2816864127561801354</id><published>2012-05-18T21:22:00.000+10:00</published><updated>2012-05-19T16:18:11.662+10:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-05-19T16:18:11.662+10:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="reproducible research" /><category scheme="http://www.blogger.com/atom/ns#" term="markup" /><category scheme="http://www.blogger.com/atom/ns#" term="R" /><title>Example Reproducible Report using R Markdown:  Analysis of California Schools Test Data</title><content type="html">&lt;p&gt;This is a quick set of analyses of the California Test Score dataset.  The post was produced using R Markdown in RStudio 0.96.  The main purpose of this post is to provide a case study of using R Markdown to prepare a quick reproducible report.  It provides examples of using plots, output, in-line R code, and markdown. The post is designed to be read along side the &lt;a href="https://gist.github.com/2724711"&gt;R Markdown source code, which is available as a gist on github&lt;/a&gt;. &lt;/p&gt;

&lt;a name='more'&gt;&lt;/a&gt;

&lt;h3&gt;Preliminaries&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;This post builds on my earlier post which provided a guide for &lt;a href="http://jeromyanglim.blogspot.com/2012/05/getting-started-with-r-markdown-knitr.html"&gt;Getting Started with R Markdown, knitr, and RStudio 0.96&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;The dataset analysed comes from the &lt;code&gt;AER&lt;/code&gt; package which is an accompaniment to the book &lt;a href="http://www.amazon.com/Applied-Econometrics-R-Use/dp/0387773169"&gt;Applied Econometrics with R&lt;/a&gt; written by &lt;a href="http://wwz.unibas.ch/personen/profil/person/kleiber/"&gt;Christian Kleiber&lt;/a&gt; and &lt;a href="http://eeecon.uibk.ac.at/%7Ezeileis/"&gt;Achim Zeileis&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Load packages and data&lt;/h3&gt;

&lt;pre&gt;&lt;code class="r"&gt;# if necessary uncomment and install packages.  install.packages(&amp;#39;AER&amp;#39;)
# install.packages(&amp;#39;psych&amp;#39;) install.packages(&amp;#39;Hmisc&amp;#39;)
# install.packages(&amp;#39;ggplot2&amp;#39;) install.packages(&amp;#39;relaimpo&amp;#39;)
library(AER)  # interesting datasets
library(psych)  # describe and psych.panels
library(Hmisc)  # describe
library(ggplot2)  # plots: ggplot and qplot
library(relaimpo)  # relative importance in regression
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code class="r"&gt;# load the California Schools Dataset and give the dataset a shorter name
data(CASchools)
cas &amp;lt;- CASchools

# Convert grade to numeric

# table(cas$grades)
cas$gradesN &lt;- cas$grades == &amp;quot;KK-08&amp;quot;

# Get the set of numeric variables
v &amp;lt;- setdiff(names(cas), c(&amp;quot;district&amp;quot;, &amp;quot;school&amp;quot;, &amp;quot;county&amp;quot;, &amp;quot;grades&amp;quot;))
&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;Q 1 What does the CASchools dataset involve?&lt;/h3&gt;

&lt;p&gt;Quoting the help (i.e., &lt;code&gt;?CASchools&lt;/code&gt;), the data is &amp;ldquo;from all 420 K-6 and K-8 districts in California with data available for 1998 and 1999&amp;rdquo; and the variables are:&lt;/p&gt;

&lt;pre&gt;&lt;code class="no-highlight"&gt;* district: character. District code.
* school: character. School name.
* county: factor indicating county.
* grades: factor indicating grade span of district.
* students: Total enrollment.
* teachers: Number of teachers.
* calworks: Percent qualifying for CalWorks (income assistance).
* lunch: Percent qualifying for reduced-price lunch.
* computer: Number of computers.
* expenditure: Expenditure per student.
* income: District average income (in USD 1,000).
* english: Percent of English learners.
* read: Average reading score.
* math: Average math score.
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Let&amp;#39;s look at the basic structure of the data frame. i.e., the number of observations and the types of values:&lt;/p&gt;

&lt;pre&gt;&lt;code class="r"&gt;str(cas)
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code class="no-highlight"&gt;## &amp;#39;data.frame&amp;#39;:    420 obs. of  15 variables:
##  $ district   : chr  &amp;quot;75119&amp;quot; &amp;quot;61499&amp;quot; &amp;quot;61549&amp;quot; &amp;quot;61457&amp;quot; ...
##  $ school     : chr  &amp;quot;Sunol Glen Unified&amp;quot; &amp;quot;Manzanita Elementary&amp;quot; &amp;quot;Thermalito Union Elementary&amp;quot; &amp;quot;Golden Feather Union Elementary&amp;quot; ...
##  $ county     : Factor w/ 45 levels &amp;quot;Alameda&amp;quot;,&amp;quot;Butte&amp;quot;,..: 1 2 2 2 2 6 29 11 6 25 ...
##  $ grades     : Factor w/ 2 levels &amp;quot;KK-06&amp;quot;,&amp;quot;KK-08&amp;quot;: 2 2 2 2 2 2 2 2 2 1 ...
##  $ students   : num  195 240 1550 243 1335 ...
##  $ teachers   : num  10.9 11.1 82.9 14 71.5 ...
##  $ calworks   : num  0.51 15.42 55.03 36.48 33.11 ...
##  $ lunch      : num  2.04 47.92 76.32 77.05 78.43 ...
##  $ computer   : num  67 101 169 85 171 25 28 66 35 0 ...
##  $ expenditure: num  6385 5099 5502 7102 5236 ...
##  $ income     : num  22.69 9.82 8.98 8.98 9.08 ...
##  $ english    : num  0 4.58 30 0 13.86 ...
##  $ read       : num  692 660 636 652 642 ...
##  $ math       : num  690 662 651 644 640 ...
##  $ gradesN    : logi  TRUE TRUE TRUE TRUE TRUE TRUE ...
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code class="r"&gt;# Hmisc::describe(cas) # For more extensive summary statistics
&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;Q. 2  To what extent does expenditure per student vary?&lt;/h3&gt;

&lt;pre&gt;&lt;code class="r"&gt;qplot(expenditure, data = cas) + xlim(0, 8000) + xlab(&amp;quot;Money spent per student ($)&amp;quot;) + 
    ylab(&amp;quot;Count of schools&amp;quot;)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;img src="http://i.imgur.com/EVAg2.png" alt="plot of chunk cas2"/&gt; &lt;/p&gt;

&lt;pre&gt;&lt;code class="r"&gt;
round(t(psych::describe(cas$expenditure)), 1)
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code class="no-highlight"&gt;##            [,1]
## var         1.0
## n         420.0
## mean     5312.4
## sd        633.9
## median   5214.5
## trimmed  5252.9
## mad       487.2
## min      3926.1
## max      7711.5
## range    3785.4
## skew        1.1
## kurtosis    1.9
## se         30.9
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The greatest expenditure per student is around double that of the least expenditure  per student.&lt;/p&gt;

&lt;h3&gt;Q. 3a  What predicts expenditure per student?&lt;/h3&gt;

&lt;pre&gt;&lt;code class="r"&gt;# Compute and format set of correlations
corExp &amp;lt;- cor(cas[&amp;quot;expenditure&amp;quot;], cas[setdiff(v, &amp;quot;expenditure&amp;quot;)])
corExp &amp;lt;- round(t(corExp), 2)
corExp[order(corExp[, 1], decreasing = TRUE), , drop = FALSE]
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code class="no-highlight"&gt;##          expenditure
## income          0.31
## read            0.22
## math            0.15
## calworks        0.07
## lunch          -0.06
## computer       -0.07
## english        -0.07
## teachers       -0.10
## students       -0.11
## gradesN        -0.17
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;More is spent per student in schools :&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;where people with greater incomes live&lt;/li&gt;
&lt;li&gt;reading scores are higher&lt;/li&gt;
&lt;li&gt;that are K-6&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;Q. 4  what is the relationship between district level maths and reading scores?&lt;/h3&gt;

&lt;pre&gt;&lt;code class="r"&gt;ggplot(cas, aes(read, math)) + geom_point() + geom_smooth()
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;img src="http://i.imgur.com/RDniX.png" alt="plot of chunk cas4"/&gt; &lt;/p&gt;

&lt;p&gt;At the district level, the correlation is very strong (r = The correlation is &lt;code&gt;0.92&lt;/code&gt;). From prior experience I&amp;#39;d expect correlations at the individual-level in the .3 to .6 range.  Thus, these results are consistent with group-level relationships  being much larger than individual-level relationships.&lt;/p&gt;

&lt;h3&gt;Q. 5 What is the relationship between maths and reading after partialling out other effects?&lt;/h3&gt;

&lt;pre&gt;&lt;code class="r"&gt;# command has strange syntax requiring column numbers rather than variable
# names
partial.r(cas[v], c(which(names(cas[v]) == &amp;quot;read&amp;quot;), which(names(cas[v]) == 
    &amp;quot;math&amp;quot;)), which(!names(cas[v]) %in% c(&amp;quot;read&amp;quot;, &amp;quot;math&amp;quot;)))
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code class="no-highlight"&gt;## partial correlations 
##      read math
## read 1.00 0.72
## math 0.72 1.00
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The partial correlation is still very strong but is substantially reduced.&lt;/p&gt;

&lt;h3&gt;Q. 6 What fraction of a computer does each student have?&lt;/h3&gt;

&lt;pre&gt;&lt;code class="r"&gt;cas$compstud &lt;- cas$computer/cas$students
describe(cas$compstud)
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code class="no-highlight"&gt;## cas$compstud 
##       n missing  unique    Mean     .05     .10     .25     .50     .75 
##     420       0     412  0.1359 0.05471 0.06654 0.09377 0.12546 0.16447 
##     .90     .95 
## 0.22494 0.24906 
## 
## lowest : 0.00000 0.01455 0.02266 0.02548 0.04167
## highest: 0.32770 0.34359 0.34979 0.35897 0.42083 
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code class="r"&gt;qplot(compstud, data = cas)
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code class="no-highlight"&gt;## stat_bin: binwidth defaulted to range/30. Use &amp;#39;binwidth = x&amp;#39; to adjust this.
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;img src="http://i.imgur.com/SEbj0.png" alt="plot of chunk unnamed-chunk-4"/&gt; &lt;/p&gt;

&lt;p&gt;The mean number of computers per student is &lt;code&gt;0.136&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;Q. 7 What is a good model of the combined effect of other variables on academic performance (i.e., math and read)?&lt;/h3&gt;

&lt;pre&gt;&lt;code class="r"&gt;# Examine correlations between variables
psych::pairs.panels(cas[v])
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;img src="http://i.imgur.com/FeULR.png" alt="plot of chunk cas7"/&gt; &lt;/p&gt;

&lt;p&gt;&lt;code&gt;pairs.panels&lt;/code&gt; shows correlations in the upper triangle, scatterplots in the lower triangle, and variable names and distributions on the main diagonal.&lt;br/&gt;
After examining the plot several ideas emerge.&lt;/p&gt;

&lt;pre&gt;&lt;code class="r"&gt;# (a) students is a count and could be log transformed
cas$studentsLog &lt;- log(cas$students)

# (b) teachers is not the variable of interest:
#   it is the number of students per teacher
cas$studteach &lt;- cas$students /cas$teachers
# (c) computers is not the variable of interest:
#  it is the ratio of computers to students
# table(cas$computer==0) 
# Note some schools have no computers so ratio would be problematic.
# Take percentage of a computer instead
cas$compstud &lt;- cas$computer / cas$students 

# (d) math and reading are correlated highly, reduce to one variable
cas$performance &amp;lt;- as.numeric(
        scale(scale(cas$read) + scale(cas$math)))
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Normally, I&amp;#39;d add all these transformations to an initial data transformation file that I call in the first block, but for the sake of the narrative, I&amp;#39;ll leave them here.&lt;/p&gt;

&lt;p&gt;Let&amp;#39;s examine correlations between predictors and outcome.&lt;/p&gt;

&lt;pre&gt;&lt;code class="r"&gt;m1cor &amp;lt;- cor(cas$performance, cas[c(&amp;quot;studentsLog&amp;quot;, &amp;quot;studteach&amp;quot;, &amp;quot;calworks&amp;quot;, 
    &amp;quot;lunch&amp;quot;, &amp;quot;compstud&amp;quot;, &amp;quot;income&amp;quot;, &amp;quot;expenditure&amp;quot;, &amp;quot;gradesN&amp;quot;)])
t(round(m1cor, 2))
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code class="no-highlight"&gt;##              [,1]
## studentsLog -0.12
## studteach   -0.23
## calworks    -0.63
## lunch       -0.87
## compstud     0.27
## income       0.71
## expenditure  0.19
## gradesN     -0.16
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Let&amp;#39;s examine the multiple regression.&lt;/p&gt;

&lt;pre&gt;&lt;code class="r"&gt;m1 &amp;lt;- lm(performance ~ studentsLog + studteach + calworks + lunch + 
    compstud + income + expenditure + grades, data = cas)
summary(m1)
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code class="no-highlight"&gt;## 
## Call:
## lm(formula = performance ~ studentsLog + studteach + calworks + 
##     lunch + compstud + income + expenditure + grades, data = cas)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1.8107 -0.2963 -0.0118  0.2712  1.5662 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(&amp;gt;|t|)    
## (Intercept)  8.99e-01   4.98e-01    1.80    0.072 .  
## studentsLog -3.83e-02   1.91e-02   -2.01    0.045 *  
## studteach   -1.11e-02   1.59e-02   -0.70    0.487    
## calworks     1.96e-03   2.96e-03    0.66    0.508    
## lunch       -2.65e-02   1.48e-03  -17.97  &amp;lt; 2e-16 ***
## compstud     7.88e-01   3.86e-01    2.04    0.042 *  
## income       2.82e-02   4.89e-03    5.77  1.6e-08 ***
## expenditure  5.87e-05   4.90e-05    1.20    0.232    
## gradesKK-08 -1.21e-01   6.49e-02   -1.87    0.062 .  
## ---
## Signif. codes:  0 &amp;#39;***&amp;#39; 0.001 &amp;#39;**&amp;#39; 0.01 &amp;#39;*&amp;#39; 0.05 &amp;#39;.&amp;#39; 0.1 &amp;#39; &amp;#39; 1 
## 
## Residual standard error: 0.457 on 411 degrees of freedom
## Multiple R-squared: 0.795,   Adjusted R-squared: 0.791 
## F-statistic:  199 on 8 and 411 DF,  p-value: &amp;lt;2e-16 
## 
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;And some indicators of predictor relative importance.&lt;/p&gt;

&lt;pre&gt;&lt;code class="r"&gt;# calc.relimp from relaimpo package.
(m1relaimpo &amp;lt;- calc.relimp(m1, type = &amp;quot;lmg&amp;quot;, rela = TRUE))
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code class="no-highlight"&gt;## Response variable: performance 
## Total response variance: 1 
## Analysis based on 420 observations 
## 
## 8 Regressors: 
## studentsLog studteach calworks lunch compstud income expenditure grades 
## Proportion of variance explained by model: 79.48%
## Metrics are normalized to sum to 100% (rela=TRUE). 
## 
## Relative importance metrics: 
## 
##                  lmg
## studentsLog 0.009973
## studteach   0.016695
## calworks    0.177666
## lunch       0.492866
## compstud    0.025815
## income      0.251769
## expenditure 0.014785
## grades      0.010432
## 
## Average coefficients for different model sizes: 
## 
##                   1X        2Xs        3Xs        4Xs        5Xs
## studentsLog -0.08771 -0.0650133 -0.0558756 -0.0519312 -4.926e-02
## studteach   -0.11918 -0.0861199 -0.0629499 -0.0462155 -3.372e-02
## calworks    -0.05473 -0.0427576 -0.0324658 -0.0233760 -1.535e-02
## lunch       -0.03199 -0.0310310 -0.0301497 -0.0293300 -2.856e-02
## compstud     4.15870  3.0673338  2.2639604  1.6844348  1.287e+00
## income       0.09860  0.0850555  0.0726892  0.0614726  5.140e-02
## expenditure  0.00030  0.0001986  0.0001374  0.0001013  8.061e-05
## grades      -0.45677 -0.3345683 -0.2529014 -0.1981200 -1.628e-01
##                    6Xs        7Xs        8Xs
## studentsLog -4.626e-02 -4.252e-02 -3.833e-02
## studteach   -2.418e-02 -1.687e-02 -1.109e-02
## calworks    -8.399e-03 -2.612e-03  1.962e-03
## lunch       -2.785e-02 -2.718e-02 -2.654e-02
## compstud     1.034e+00  8.828e-01  7.884e-01
## income       4.250e-02  3.477e-02  2.821e-02
## expenditure  6.882e-05  6.206e-05  5.871e-05
## grades      -1.414e-01 -1.291e-01 -1.215e-01
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Thus, we can conclude that:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Income and indicators of income (e.g., low levels of lunch vouchers) are the two main predictors. Thus, schools with greater average income tend to have better student performance.&lt;/li&gt;
&lt;li&gt;Schools with more computers per student have better student performance.&lt;/li&gt;
&lt;li&gt;Schools with fewer students per teacher have better student performance.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For more information about relative importance and the &lt;code&gt;relaimpo&lt;/code&gt; package measures check out &lt;a href="http://prof.beuth-hochschule.de/groemping/relaimpo/"&gt;Ulrike Grömping&amp;#39;s website&lt;/a&gt;.&lt;br/&gt;
Of course this is all observational data with the usual caveats regarding causal interpretation.&lt;/p&gt;

&lt;h2&gt;Now, let&amp;#39;s look at some weird stuff.&lt;/h2&gt;

&lt;h3&gt;Q. 8.1 What are common words in Californian School names?&lt;/h3&gt;

&lt;pre&gt;&lt;code class="r"&gt;# create a vector of the words that occur in school names
lw &amp;lt;- unlist(strsplit(cas$school, split = &amp;quot; &amp;quot;))

# create a table of the frequency of school names
tlw &amp;lt;- table(lw)

# extract cells of table with count greater than 3
tlw2 &amp;lt;- tlw[tlw &amp;gt; 3]

# sorted in decreasing order
tlw2 &amp;lt;- sort(tlw2, decreasing = TRUE)

# values as proporitions
tlw2p &amp;lt;- round(tlw2/nrow(cas), 3)

# show this in a bar graph
tlw2pdf &amp;lt;- data.frame(word = names(tlw2p), prop = as.numeric(tlw2p), 
    stringsAsFactors = FALSE)
ggplot(tlw2pdf, aes(word, prop)) + geom_bar() + coord_flip()
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;img src="http://i.imgur.com/eqxKN.png" alt="plot of chunk unnamed-chunk-8"/&gt; &lt;/p&gt;

&lt;pre&gt;&lt;code class="r"&gt;# make it log counts
ggplot(tlw2pdf, aes(word, log(prop * nrow(cas)))) + geom_bar() + 
    coord_flip()
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;img src="http://i.imgur.com/NJPiK.png" alt="plot of chunk unnamed-chunk-9"/&gt; &lt;/p&gt;

&lt;p&gt;The word &amp;ldquo;Elementary&amp;rdquo; appears in almost all school names (&lt;code&gt;98.3&lt;/code&gt;%).  The word &amp;ldquo;Union&amp;rdquo; appears in around half (&lt;code&gt;43.3&lt;/code&gt;%).&lt;/p&gt;

&lt;p&gt;Other common words pertain to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Directions (e.g., South, West), &lt;/li&gt;
&lt;li&gt;Features of the environment 
(e.g., Creek, Vista, View, Valley)&lt;/li&gt;
&lt;li&gt;Spanish words (e.g., rio for river; san for saint)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Q. 8.2 Is the number of letters in the school&amp;#39;s name related to academic performance?&lt;/h3&gt;

&lt;pre&gt;&lt;code class="r"&gt;cas$namelen &lt;- nchar(cas$school)
table(cas$namelen)
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code class="no-highlight"&gt;## 
## 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 37 38 39 
##  1  4  9 26 28 31 33 27 30 45 38 28 36 30 18 10  5  4  6  3  1  2  2  2  1 
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code class="r"&gt;round(cor(cas$namelen, cas[, c(&amp;quot;read&amp;quot;, &amp;quot;math&amp;quot;)]), 2)
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code class="no-highlight"&gt;##      read math
## [1,] 0.03    0
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The answer appears to be &amp;ldquo;no&amp;rdquo;.&lt;/p&gt;

&lt;h3&gt;Q.  8.3 Is the number of words in the school name related to academic performance?&lt;/h3&gt;

&lt;pre&gt;&lt;code class="r"&gt;cas$nameWordCount &lt;- sapply(strsplit(cas$school, &amp;quot; &amp;quot;), length)
table(cas$nameWordCount)
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code class="no-highlight"&gt;## 
##   2   3   4   5 
## 140 202  72   6 
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code class="r"&gt;round(cor(cas$nameWordCount, cas[, c(&amp;quot;read&amp;quot;, &amp;quot;math&amp;quot;)]), 2)
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code class="no-highlight"&gt;##      read math
## [1,] 0.05 0.01
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The answer appears to be &amp;ldquo;no&amp;rdquo;.&lt;/p&gt;

&lt;h3&gt;Q. 8.4 Are schools with nice popular nature words in their name doing better academically?&lt;/h3&gt;

&lt;pre&gt;&lt;code class="r"&gt;tlw2p  #recall the list of popular names
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code class="no-highlight"&gt;## lw
## Elementary      Union       City     Valley      Joint       View 
##      0.983      0.433      0.060      0.040      0.031      0.019 
##   Pleasant        San      Creek        Oak      Santa       Lake 
##      0.017      0.017      0.014      0.014      0.014      0.012 
##   Mountain       Park        Rio      Vista      Grove   Lakeside 
##      0.012      0.012      0.012      0.012      0.010      0.010 
##      South    Unified       West 
##      0.010      0.010      0.010 
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code class="r"&gt;# Create a quick and dirty list of popular nature names
naturenames &amp;lt;- c(&amp;quot;Valley&amp;quot;, &amp;quot;View&amp;quot;, &amp;quot;Creek&amp;quot;, &amp;quot;Lake&amp;quot;, &amp;quot;Mountain&amp;quot;, &amp;quot;Park&amp;quot;, 
    &amp;quot;Rio&amp;quot;, &amp;quot;Vista&amp;quot;, &amp;quot;Grove&amp;quot;, &amp;quot;Lakeside&amp;quot;)

# work out whether the word is in the school name
schsplit &amp;lt;- strsplit(cas$school, &amp;quot; &amp;quot;)
cas$hasNature &amp;lt;- sapply(schsplit, function(X) length(intersect(X, 
    naturenames)) &amp;gt; 0)
round(cor(cas$hasNature, cas[, c(&amp;quot;read&amp;quot;, &amp;quot;math&amp;quot;)]), 2)
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code class="no-highlight"&gt;##      read math
## [1,] 0.09 0.08
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;So we&amp;#39;ve found a small correlation.&lt;br/&gt;&lt;br/&gt;
Let&amp;#39;s graph the data to see what it means:&lt;/p&gt;

&lt;pre&gt;&lt;code class="r"&gt;ggplot(cas, aes(hasNature, read)) + geom_boxplot() + geom_jitter(position = position_jitter(width = 0.1)) + 
    xlab(&amp;quot;Has a nature name&amp;quot;) + ylab(&amp;quot;Mean student reading score&amp;quot;)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;img src="http://i.imgur.com/TyyL3.png" alt="plot of chunk unnamed-chunk-14"/&gt; &lt;/p&gt;

&lt;p&gt;So in the sample nature schools have slightly better reading score (and if we were to graph it, maths scores). However, the number of schools having nature names is actually somewhat small (n= &lt;code&gt;61&lt;/code&gt;) despite the overall quite large sample size.&lt;/p&gt;

&lt;p&gt;But is it statistically significant?&lt;/p&gt;

&lt;pre&gt;&lt;code class="r"&gt;t.read &amp;lt;- t.test(cas[cas$hasNature, "read"], cas[!cas$hasNature, 
    &amp;quot;read&amp;quot;])
t.math &amp;lt;- t.test(cas[cas$hasNature, "math"], cas[!cas$hasNature, 
    &amp;quot;math&amp;quot;])
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;So, the p-value is less than .05 for reading (p = &lt;code&gt;0.046&lt;/code&gt;) but not quite for maths (p = &lt;code&gt;0.083&lt;/code&gt;).  Bingo!  After a little bit of data fishing we have found that reading scores are &amp;ldquo;significantly&amp;rdquo; greater for those schools with the listed nature names.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;But wait&lt;/strong&gt;: I&amp;#39;ve asked three separate exploratory questions or perhaps six if we take maths into account.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;$\frac{.05}{3} =$ &lt;code&gt;0.0167&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;$\frac{.05}{6} =$ &lt;code&gt;0.0083&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;At these Bonferonni corrected p-values,  the result is non-significant. Oh well&amp;hellip;&lt;/p&gt;

&lt;h2&gt;Review&lt;/h2&gt;

&lt;p&gt;Anyway, the aim of this post was not to make profound statements about California schools. Rather the aim was to show how easy it is to produce quick reproducible reports with R Markdown. If you haven&amp;#39;t already, you may want to open up &lt;a href="https://gist.github.com/2724711"&gt;the R Markdown file used to produce this post&lt;/a&gt; in RStudio, and compile the report yourself.&lt;/p&gt;

&lt;p&gt;In particular, I can see R Markdown being my tool of choice for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Blog posts&lt;/li&gt;
&lt;li&gt;Posts to StackExchange sites&lt;/li&gt;
&lt;li&gt;Materials for training workshops&lt;/li&gt;
&lt;li&gt;Short consulting reports, and&lt;/li&gt;
&lt;li&gt;Exploratory analyses as part of a larger project.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The real question is how far I can push Markdown before I start to miss the control of LaTeX.  Markdown does permit arbitrary HTML. Anyway, if you have any thoughts about the scope of R Markdown, feel free to add a comment.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=FFTRZL7ZCb4:YH1N5WfhkMQ:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=FFTRZL7ZCb4:YH1N5WfhkMQ:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=FFTRZL7ZCb4:YH1N5WfhkMQ:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=FFTRZL7ZCb4:YH1N5WfhkMQ:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=FFTRZL7ZCb4:YH1N5WfhkMQ:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=FFTRZL7ZCb4:YH1N5WfhkMQ:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=FFTRZL7ZCb4:YH1N5WfhkMQ:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=FFTRZL7ZCb4:YH1N5WfhkMQ:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=FFTRZL7ZCb4:YH1N5WfhkMQ:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/jeromyanglim/~4/FFTRZL7ZCb4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://jeromyanglim.blogspot.com/feeds/2816864127561801354/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://jeromyanglim.blogspot.com/2012/05/example-reproducile-report-using-r.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8909074830238091680/posts/default/2816864127561801354?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8909074830238091680/posts/default/2816864127561801354?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/jeromyanglim/~3/FFTRZL7ZCb4/example-reproducile-report-using-r.html" title="Example Reproducible Report using R Markdown:  Analysis of California Schools Test Data" /><author><name>Jeromy Anglim</name><uri>https://plus.google.com/100803004599943057656</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-xUmT1aa-RI0/AAAAAAAAAAI/AAAAAAAAAvk/eN47FjC3uVU/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://jeromyanglim.blogspot.com/2012/05/example-reproducile-report-using-r.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEYBQHoyfip7ImA9WhVUEks.&quot;"><id>tag:blogger.com,1999:blog-8909074830238091680.post-9141855655749942892</id><published>2012-05-17T14:31:00.000+10:00</published><updated>2012-05-17T23:42:31.496+10:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-05-17T23:42:31.496+10:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="reproducible research" /><category scheme="http://www.blogger.com/atom/ns#" term="Sweave" /><category scheme="http://www.blogger.com/atom/ns#" term="R" /><title>Getting Started with R Markdown, knitr, and Rstudio 0.96</title><content type="html">&lt;p&gt;This post examines the features of &lt;a href="http://www.rstudio.org/docs/authoring/using_markdown"&gt;R Markdown&lt;/a&gt; 
using &lt;a href="http://yihui.name/knitr/"&gt;knitr&lt;/a&gt; in Rstudio 0.96.
This combination of tools provides an exciting improvement in usability for 
&lt;a href="http://stats.stackexchange.com/a/15006/183"&gt;reproducible analysis&lt;/a&gt;.
Specifically, this post 
(1) discusses getting started with R Markdown and &lt;code&gt;knitr&lt;/code&gt; 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.
This post was produced with R Markdown. The &lt;a href="https://gist.github.com/2716336"&gt;source code is available here as a gist&lt;/a&gt;. 
The post may be most useful if the source code and displayed post are viewed side by side. 
In some instances, I include a copy of the R Markdown in the displayed HTML, but most of the time I assume you are reading the source and post side by side.&lt;/p&gt;

&lt;a name='more'&gt;&lt;/a&gt;

&lt;h2&gt;Getting started&lt;/h2&gt;

&lt;p&gt;To work with R Markdown, if necessary:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Install &lt;a href="http://www.r-project.org/"&gt;R&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Install the lastest version of &lt;a href="http://rstudio.org/download/"&gt;RStudio&lt;/a&gt; (at time of posting, this is 0.96)&lt;/li&gt;
&lt;li&gt;Install the latest version of the &lt;code&gt;knitr&lt;/code&gt; package: &lt;code&gt;install.packages(&amp;quot;knitr&amp;quot;)&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To run the basic working example that produced this blog post:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Open R Studio, and go to File - New - R Markdown&lt;/li&gt;
&lt;li&gt;If necessary install &lt;code&gt;ggplot2&lt;/code&gt; and &lt;code&gt;lattice&lt;/code&gt; packages: &lt;code&gt;install.packages(&amp;quot;ggplot2&amp;quot;); install.packages(&amp;quot;lattice&amp;quot;)&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Paste in the contents of &lt;a href="https://gist.github.com/2716336"&gt;the gist (which contains the R Markdown file used to produce this post)&lt;/a&gt; and save the file with an &lt;code&gt;.rmd&lt;/code&gt; extension&lt;/li&gt;
&lt;li&gt;Click Knit HTML&lt;/li&gt;
&lt;/ul&gt;

&lt;pre&gt;&lt;code class="r"&gt;opts_knit$set(upload.fun = imgur_upload)  # upload all images to imgur.com
&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Prepare for analyses&lt;/h2&gt;

&lt;pre&gt;&lt;code class="r"&gt;set.seed(1234)
library(ggplot2)
library(lattice)
&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Basic console output&lt;/h2&gt;

&lt;p&gt;To insert an R code chunk, you can type it manually or just press &lt;code&gt;Chunks - Insert chunks&lt;/code&gt; or use the shortcut key. This will produce the following code chunk:&lt;/p&gt;

&lt;pre&gt;&lt;code class="no-highlight"&gt;```{r}

```
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Pressing tab when inside the braces will bring up code chunk options.&lt;/p&gt;

&lt;p&gt;The following R code chunk labelled &lt;code&gt;basicconsole&lt;/code&gt; is as follows:&lt;/p&gt;

&lt;pre&gt;&lt;code class="no-highlight"&gt;```{r basicconsole}
x &amp;lt;- 1:10
y &amp;lt;- round(rnorm(10, x, 1), 2)
df &amp;lt;- data.frame(x, y)
df
```
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The code chunk input and output is then displayed as follows:&lt;/p&gt;

&lt;pre&gt;&lt;code class="r"&gt;x &amp;lt;- 1:10
y &amp;lt;- round(rnorm(10, x, 1), 2)
df &amp;lt;- data.frame(x, y)
df
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code class="no-highlight"&gt;##     x    y
## 1   1 1.31
## 2   2 2.31
## 3   3 3.36
## 4   4 3.27
## 5   5 5.04
## 6   6 6.11
## 7   7 8.43
## 8   8 8.98
## 9   9 8.38
## 10 10 9.27
&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Plots&lt;/h2&gt;

&lt;p&gt;Images generated by &lt;code&gt;knitr&lt;/code&gt; are saved in a figures folder. However, they also appear to be represented in the HTML output using a &lt;a href="http://en.wikipedia.org/wiki/Data_URI_scheme"&gt;data URI scheme&lt;/a&gt;. This means that you can paste the HTML into a blog post or discussion forum and you don&amp;#39;t have to worry about finding a place to store the images; they&amp;#39;re embedded in the HTML.&lt;/p&gt;

&lt;h3&gt;Simple plot&lt;/h3&gt;

&lt;p&gt;Here is a basic plot using base graphics:&lt;/p&gt;

&lt;pre&gt;&lt;code class="no-highlight"&gt;```{r simpleplot}
plot(x)
```
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code class="r"&gt;plot(x)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;img src="http://i.imgur.com/JRrm8.png" alt="plot of chunk simpleplot"/&gt; &lt;/p&gt;

&lt;p&gt;Note that unlike traditional Sweave, there is no need to write &lt;code&gt;fig=TRUE&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;Multiple plots&lt;/h3&gt;

&lt;p&gt;Also, unlike traditional Sweave, you can include multiple plots in one code chunk:&lt;/p&gt;

&lt;pre&gt;&lt;code class="no-highlight"&gt;```{r multipleplots}
boxplot(1:10~rep(1:2,5))
plot(x, y)
```
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code class="r"&gt;boxplot(1:10 ~ rep(1:2, 5))
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;img src="http://i.imgur.com/TW0G1.png" alt="plot of chunk multipleplots"/&gt; &lt;/p&gt;

&lt;pre&gt;&lt;code class="r"&gt;plot(x, y)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;img src="http://i.imgur.com/36WWn.png" alt="plot of chunk multipleplots"/&gt; &lt;/p&gt;

&lt;h3&gt;&lt;code&gt;ggplot2&lt;/code&gt; plot&lt;/h3&gt;

&lt;p&gt;Ggplot2 plots work well:&lt;/p&gt;

&lt;pre&gt;&lt;code class="r"&gt;qplot(x, y, data = df)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;img src="http://i.imgur.com/s5mct.png" alt="plot of chunk ggplot2ex"/&gt; &lt;/p&gt;

&lt;h3&gt;&lt;code&gt;lattice&lt;/code&gt; plot&lt;/h3&gt;

&lt;p&gt;As do lattice plots:&lt;/p&gt;

&lt;pre&gt;&lt;code class="r"&gt;xyplot(y ~ x)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;img src="http://i.imgur.com/qXKUO.png" alt="plot of chunk latticeex"/&gt; &lt;/p&gt;

&lt;p&gt;Note that unlike traditional Sweave, there is no need to print lattice plots directly.&lt;/p&gt;

&lt;h2&gt;R Code chunk features&lt;/h2&gt;

&lt;h3&gt;Create Markdown code from R&lt;/h3&gt;

&lt;p&gt;The following code hides the command input (i.e., &lt;code&gt;echo=FALSE&lt;/code&gt;), and outputs the content directly as code (i.e., &lt;code&gt;results=asis&lt;/code&gt;, which is similar to &lt;code&gt;results=tex&lt;/code&gt; in Sweave).&lt;/p&gt;

&lt;pre&gt;&lt;code class="no-highlight"&gt;```{r dotpointprint, results=&amp;#39;asis&amp;#39;, echo=FALSE}
cat(&amp;quot;Here are some dot points\n\n&amp;quot;)
cat(paste(&amp;quot;* The value of y[&amp;quot;, 1:3, &amp;quot;] is &amp;quot;, y[1:3], sep=&amp;quot;&amp;quot;, collapse=&amp;quot;\n&amp;quot;))
```
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Here are some dot points&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The value of y[1] is 1.31&lt;/li&gt;
&lt;li&gt;The value of y[2] is 2.31&lt;/li&gt;
&lt;li&gt;The value of y[3] is 3.36&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Create Markdown table code from R&lt;/h3&gt;

&lt;pre&gt;&lt;code class="no-highlight"&gt;```{r createtable, results=&amp;#39;asis&amp;#39;, echo=FALSE}
cat(&amp;quot;x | y&amp;quot;, &amp;quot;--- | ---&amp;quot;, sep=&amp;quot;\n&amp;quot;)
cat(apply(df, 1, function(X) paste(X, collapse=&amp;quot; | &amp;quot;)), sep = &amp;quot;\n&amp;quot;)
```
&lt;/code&gt;&lt;/pre&gt;

&lt;table&gt;&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;x&lt;/th&gt;
&lt;th&gt;y&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;1.31&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;2.31&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;3.36&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;3.27&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;5.04&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;td&gt;6.11&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;7&lt;/td&gt;
&lt;td&gt;8.43&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;8&lt;/td&gt;
&lt;td&gt;8.98&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;9&lt;/td&gt;
&lt;td&gt;8.38&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;10&lt;/td&gt;
&lt;td&gt;9.27&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;

&lt;h3&gt;Control output display&lt;/h3&gt;

&lt;p&gt;The folllowing code supresses display of R input commands (i.e., &lt;code&gt;echo=FALSE&lt;/code&gt;)
and removes any preceding text from console output (&lt;code&gt;comment=&amp;quot;&amp;quot;&lt;/code&gt;; the default is &lt;code&gt;comment=&amp;quot;##&amp;quot;&lt;/code&gt;).&lt;/p&gt;

&lt;pre&gt;&lt;code class="no-highlight"&gt;```{r echo=FALSE, comment=&amp;quot;&amp;quot;, echo=FALSE}
head(df)
```
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code class="no-highlight"&gt;  x    y
1 1 1.31
2 2 2.31
3 3 3.36
4 4 3.27
5 5 5.04
6 6 6.11
&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;Control figure size&lt;/h3&gt;

&lt;p&gt;The following is an example of a smaller figure using &lt;code&gt;fig.width&lt;/code&gt; and &lt;code&gt;fig.height&lt;/code&gt; options.&lt;/p&gt;

&lt;pre&gt;&lt;code class="no-highlight"&gt;```{r smallplot, fig.width=3, fig.height=3}
plot(x)
```
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code class="r"&gt;plot(x)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;img src="http://i.imgur.com/fg18e.png" alt="plot of chunk smallplot"/&gt; &lt;/p&gt;

&lt;h3&gt;Cache analysis&lt;/h3&gt;

&lt;p&gt;Caching analyses is straightforward.
Here&amp;#39;s example code. 
On the first run on my computer, this took about 10 seconds.
On subsequent runs, this code was not run. &lt;/p&gt;

&lt;p&gt;If you want to rerun cached code chunks, just &lt;a href="http://stackoverflow.com/a/10629121/180892"&gt;delete the contents of the &lt;code&gt;cache&lt;/code&gt; folder&lt;/a&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code class="no-highlight"&gt;```{r longanalysis, cache=TRUE}
for (i in 1:5000) {
    lm((i+1)~i)
}
```
&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Basic markdown functionality&lt;/h2&gt;

&lt;p&gt;For those not familiar with standard &lt;a href="http://daringfireball.net/projects/markdown/"&gt;Markdown&lt;/a&gt;, the following may be useful.
See the source code for how to produce such points. However, RStudio does include a Markdown quick reference button that adequatly covers this material.&lt;/p&gt;

&lt;h3&gt;Dot Points&lt;/h3&gt;

&lt;p&gt;Simple dot points:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Point 1&lt;/li&gt;
&lt;li&gt;Point 2&lt;/li&gt;
&lt;li&gt;Point 3&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;and numeric dot points:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Number 1&lt;/li&gt;
&lt;li&gt;Number 2&lt;/li&gt;
&lt;li&gt;Number 3&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;and nested dot points:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A

&lt;ul&gt;
&lt;li&gt;A.1&lt;/li&gt;
&lt;li&gt;A.2&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;B

&lt;ul&gt;
&lt;li&gt;B.1&lt;/li&gt;
&lt;li&gt;B.2&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Equations&lt;/h3&gt;

&lt;p&gt;Equations are included by using LaTeX notation and including them either between single dollar signs (inline equations) or double dollar signs (displayed equations).
If you hang around the Q&amp;amp;A site &lt;a href="http://stats.stackexchange.com"&gt;CrossValidated&lt;/a&gt; you&amp;#39;ll be familiar with this idea.&lt;/p&gt;

&lt;p&gt;There are inline equations such as $y_i = \alpha + \beta x_i + e_i$.&lt;/p&gt;

&lt;p&gt;And displayed formulas:&lt;/p&gt;

&lt;p&gt;$$\frac{1}{1+\exp(-x)}$$&lt;/p&gt;

&lt;p&gt;knitr provides self-contained HTML code that calls a Mathjax script to display formulas.
However, in order to include the script in my blog posts I &lt;a href="https://gist.github.com/2716053"&gt;took the script&lt;/a&gt; and incorporated it into my blogger template.
If you are viewing this post through syndication or an RSS reader, this may not work.
You may need to view this post on my website. &lt;/p&gt;

&lt;h3&gt;Tables&lt;/h3&gt;

&lt;p&gt;Tables can be included using the following notation&lt;/p&gt;

&lt;table&gt;&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;A&lt;/th&gt;
&lt;th&gt;B&lt;/th&gt;
&lt;th&gt;C&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;Male&lt;/td&gt;
&lt;td&gt;Blue&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;Female&lt;/td&gt;
&lt;td&gt;Pink&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;

&lt;h3&gt;Hyperlinks&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;If you like this post, you may wish to subscribe to &lt;a href="http://feeds.feedburner.com/jeromyanglim"&gt;my RSS feed&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Images&lt;/h3&gt;

&lt;p&gt;Here&amp;#39;s an example image:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://i.imgur.com/RVNmr.jpg" alt="image from redmond barry building unimelb"/&gt;&lt;/p&gt;

&lt;h3&gt;Code&lt;/h3&gt;

&lt;p&gt;Here is Markdown R code chunk displayed as code:&lt;/p&gt;

&lt;pre&gt;&lt;code class="no-highlight"&gt;```{r}
x &amp;lt;- 1:10
x
```
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;And then there&amp;#39;s inline code such as &lt;code&gt;x &amp;lt;- 1:10&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;Quote&lt;/h3&gt;

&lt;p&gt;Let&amp;#39;s quote some stuff:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;To be, or not to be, that is the question:
Whether &amp;#39;tis nobler in the mind to suffer
The slings and arrows of outrageous fortune,&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;Conclusion&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;R Markdown is awesome. 

&lt;ul&gt;
&lt;li&gt;The ratio of markup to content is excellent. &lt;/li&gt;
&lt;li&gt;For exploratory analyses, blog posts, and the like R Markdown will be a powerful productivity booster. &lt;/li&gt;
&lt;li&gt;For journal articles, LaTeX will presumably still be required.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;The RStudio team have made the whole process very user friendly.

&lt;ul&gt;
&lt;li&gt;RStudio provides useful shortcut keys for compiling to HTML, and running code chunks. These shortcut keys are presented in a clear way.&lt;/li&gt;
&lt;li&gt;The incorporated extensions to Markdown, particularly formula and table support, are particularly useful.&lt;/li&gt;
&lt;li&gt;Jump-to-chunk feature facilitates navigation. It helps if your code chunks have informative names.&lt;/li&gt;
&lt;li&gt;Code completion on R code chunk options is really helpful. See also &lt;a href="http://yihui.name/knitr/options"&gt;chunk options documentation on the knitr website&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;Other recent posts on R markdown include those by :

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://christophergandrud.blogspot.com.au/2012/05/dynamic-content-with-rstudio-markdown.html"&gt;Christopher Gandrud&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://lamages.blogspot.com.au/2012/05/interactive-reports-in-r-with-knitr-and.html"&gt;Markcus Gesmann&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://rstudio.org/docs/authoring/using_markdown"&gt;Rstudio on R Markdown&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://yihui.name/knitr/"&gt;Yihui Xie&lt;/a&gt;: I really want to thank him for developing &lt;code&gt;knitr&lt;/code&gt;. 
He has also posted &lt;a href="https://github.com/yihui/knitr/blob/master/inst/examples/knitr-minimal.Rmd"&gt;this example of R Markdown&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Questions&lt;/h2&gt;

&lt;p&gt;The following are a few questions I encountered along the way that might interest others.&lt;/p&gt;

&lt;h3&gt;Annoying &lt;code&gt;&amp;lt;br/&amp;gt;&lt;/code&gt;&amp;#39;s&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Question:&lt;/strong&gt; I asked on the Rstudio discussion site:
&lt;a href="http://support.rstudio.org/help/discussions/problems/2329-why-does-r-markdown-to-html-insert-br-when-there-is-a-new-line-of-text"&gt;Why does Markdown to HTML insert &lt;code&gt;&amp;lt;br/&amp;gt;&lt;/code&gt; on new lines?&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Answer:&lt;/strong&gt; I just do a find and delete on this text for now.
Specifically, I have a sed command that extracts just the content between the &lt;code&gt;body&lt;/code&gt; tags and removes &lt;code&gt;br&lt;/code&gt; tags.
I can then, readily incorporate the result into my blogposts.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sed -i -e '1,/&amp;lt;body&amp;gt;/d' -e'/^&amp;lt;\/body&amp;gt;/,$d' -e 's/&amp;lt;br\/&amp;gt;$//' filename.html
&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;Temporarily disable caching&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Question:&lt;/strong&gt; I asked on StackOverflow about 
&lt;a href="http://stackoverflow.com/q/10628665/180892"&gt;How to set cache=FALSE for a knitr markdown document and override code chunk settings?&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Answer:&lt;/strong&gt;  Delete the cache folder. But there are other possible workflows.&lt;/p&gt;

&lt;h3&gt;Equivalent of Sexpr&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Question:&lt;/strong&gt; I asked on Stack Overvlow about &lt;a href="http://stackoverflow.com/q/10629416/180892"&gt;whether there an R Markdown equivalent to Sexpr in Sweave?&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Answer:&lt;/strong&gt; Include the code between brackets of &amp;ldquo;backtick r space&amp;rdquo; and &amp;ldquo;backtick&amp;rdquo;. 
E.g., in the source code I have calculated 2 + 2 = &lt;code&gt;4&lt;/code&gt; .&lt;/p&gt;

&lt;h3&gt;Image format&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Question:&lt;/strong&gt; When using the URI scheme images don&amp;#39;t appear to display in RSS feeds of my blog.
What&amp;#39;s a good strategy?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Answer:&lt;/strong&gt; One strategy is to upload to imgur.
The &lt;a href="https://raw.github.com/yihui/knitr/master/inst/examples/knitr-upload.Rmd"&gt;following provides&lt;/a&gt; an example of exporting to imgur.&lt;/p&gt;

&lt;p&gt;Add the following lines of code near the top of the file:&lt;/p&gt;

&lt;pre&gt;&lt;code class="no-highlight"&gt;``` {r optsknit}
opts_knit$set(upload.fun = imgur_upload) # upload all images to imgur.com
```
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I found that the function failed when I was at work behind a firewall, but worked at home.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=LcxgogcYlPE:H8JBOWmDWMM:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=LcxgogcYlPE:H8JBOWmDWMM:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=LcxgogcYlPE:H8JBOWmDWMM:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=LcxgogcYlPE:H8JBOWmDWMM:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=LcxgogcYlPE:H8JBOWmDWMM:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=LcxgogcYlPE:H8JBOWmDWMM:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=LcxgogcYlPE:H8JBOWmDWMM:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=LcxgogcYlPE:H8JBOWmDWMM:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=LcxgogcYlPE:H8JBOWmDWMM:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/jeromyanglim/~4/LcxgogcYlPE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://jeromyanglim.blogspot.com/feeds/9141855655749942892/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://jeromyanglim.blogspot.com/2012/05/getting-started-with-r-markdown-knitr.html#comment-form" title="40 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8909074830238091680/posts/default/9141855655749942892?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8909074830238091680/posts/default/9141855655749942892?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/jeromyanglim/~3/LcxgogcYlPE/getting-started-with-r-markdown-knitr.html" title="Getting Started with R Markdown, knitr, and Rstudio 0.96" /><author><name>Jeromy Anglim</name><uri>https://plus.google.com/100803004599943057656</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-xUmT1aa-RI0/AAAAAAAAAAI/AAAAAAAAAvk/eN47FjC3uVU/s512-c/photo.jpg" /></author><thr:total>40</thr:total><feedburner:origLink>http://jeromyanglim.blogspot.com/2012/05/getting-started-with-r-markdown-knitr.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUYDSX09fyp7ImA9WhVVEEU.&quot;"><id>tag:blogger.com,1999:blog-8909074830238091680.post-4693518112289819334</id><published>2012-05-03T22:31:00.000+10:00</published><updated>2012-05-04T09:19:38.367+10:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-05-04T09:19:38.367+10:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="ggplot2" /><category scheme="http://www.blogger.com/atom/ns#" term="R" /><title>How to plot three categorical variables and one continuous variable using ggplot2</title><content type="html">&lt;p&gt;This post shows how to produce a plot involving three categorical variables
and one continuous variable using &lt;code&gt;ggplot2&lt;/code&gt; in R.&lt;/p&gt;

&lt;a name='more'&gt;&lt;/a&gt;

&lt;p&gt;The &lt;a href="https://gist.github.com/2585249"&gt;following code is also available as a gist on github&lt;/a&gt;.&lt;/p&gt;

&lt;h5&gt;1. Create Data&lt;/h5&gt;

&lt;p&gt;First, let's load &lt;code&gt;ggplot2&lt;/code&gt; and create some data to work with:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;library(ggplot2)

set.seed(4444)
Data &amp;lt;- 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 &amp;lt;- data.frame(
    group=c("Apples", "Bananas", "Carrots", "Durians", "Eggplants"),
    group.weight=c(1,1,-1,0.5, 0))
Quality.Weight &amp;lt;- data.frame(
    quality=c("Grade A", "Grade B", "Grade C", "Grade D", "Grade E"),
    quality.weight = c(1,0.5,0,-0.5,-1))
Data &amp;lt;- merge(Data, Group.Weight)
Data &amp;lt;- merge(Data, Quality.Weight)
Data$score &amp;lt;- Data$group.weight + Data$quality.weight + 
    rnorm(nrow(Data), 0, 0.2)
Data$proportion.tasty &amp;lt;- exp(Data$score)/(1 + exp(Data$score))
&lt;/code&gt;&lt;/pre&gt;

&lt;h5&gt;2. Produce Plot&lt;/h5&gt;

&lt;p&gt;And here's the code to produce the plot.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;ggplot(data=Data, 
       aes(x=factor(year), y=proportion.tasty, 
           group=group,
           shape=group,
           color=group)) + 
               geom_line() + 
               geom_point() +
               opts(title = 
               "Proportion Tasty by Year, Quality, and Group") +
               scale_x_discrete("Year") +
               scale_y_continuous("Proportion Tasty") + 
        facet_grid(.~quality )
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;And here's what it looks like:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://imgur.com/UWZgd"&gt;&lt;img src="http://i.imgur.com/UWZgd.png" 
title="three categorical variables ggplot2" width=520 alt="three categorical variables ggplot2" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=OIZwqau-Kaw:SHQnWM5BSyI:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=OIZwqau-Kaw:SHQnWM5BSyI:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=OIZwqau-Kaw:SHQnWM5BSyI:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=OIZwqau-Kaw:SHQnWM5BSyI:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=OIZwqau-Kaw:SHQnWM5BSyI:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=OIZwqau-Kaw:SHQnWM5BSyI:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=OIZwqau-Kaw:SHQnWM5BSyI:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=OIZwqau-Kaw:SHQnWM5BSyI:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=OIZwqau-Kaw:SHQnWM5BSyI:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/jeromyanglim/~4/OIZwqau-Kaw" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://jeromyanglim.blogspot.com/feeds/4693518112289819334/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://jeromyanglim.blogspot.com/2012/05/how-to-plot-three-categorical-variables.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8909074830238091680/posts/default/4693518112289819334?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8909074830238091680/posts/default/4693518112289819334?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/jeromyanglim/~3/OIZwqau-Kaw/how-to-plot-three-categorical-variables.html" title="How to plot three categorical variables and one continuous variable using ggplot2" /><author><name>Jeromy Anglim</name><uri>https://plus.google.com/100803004599943057656</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-xUmT1aa-RI0/AAAAAAAAAAI/AAAAAAAAAvk/eN47FjC3uVU/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://jeromyanglim.blogspot.com/2012/05/how-to-plot-three-categorical-variables.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0QCQnw6eyp7ImA9WhBVGUU.&quot;"><id>tag:blogger.com,1999:blog-8909074830238091680.post-2161909575284784854</id><published>2012-04-11T15:50:00.001+10:00</published><updated>2013-04-26T23:02:43.213+10:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-04-26T23:02:43.213+10:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="bayesian" /><category scheme="http://www.blogger.com/atom/ns#" term="jags" /><category scheme="http://www.blogger.com/atom/ns#" term="R" /><title>Getting Started with JAGS, rjags, and Bayesian Modelling</title><content type="html">&lt;p&gt;This post provides links to various resources on getting started with Bayesian modelling using JAGS and R. It discusses: (1) what is JAGS; (2) why you might want to perform Bayesian modelling using JAGS; (3) how to install JAGS; (4) where to find further information on JAGS; (5) where to find examples of JAGS scripts in action; (6) where to ask questions; and (7) some interesting psychological applications of Bayesian modelling.&lt;/p&gt;

&lt;a name='more'&gt;&lt;/a&gt;


&lt;h3&gt;What is JAGS?&lt;/h3&gt;

&lt;p&gt;JAGS stands for Just Another Gibbs Sampler. To quote the program author, Martyn Plummer, "It is a program for analysis of Bayesian hierarchical models using Markov Chain Monte Carlo (MCMC) simulation..." It uses a dialect of the BUGS language, similar but a little different to OpenBUGS and WinBUGS.&lt;/p&gt;

&lt;h3&gt;Why JAGS?&lt;/h3&gt;

&lt;p&gt;The question of why you might want to use JAGS can be approached in several different ways:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Why Bayesian rather than Null Hypothesis Significance Testing (&lt;a href="http://yatani.jp/HCIstats/NHST"&gt;NHST&lt;/a&gt;) approaches?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To quote John D. Cook quoting Anthony O'Hagan, the benefits of "the bayesian approach are that it is 1. fundamentally sound, 2. very flexible, 3. produces clear and direct inferences, and 4. makes use of all available information." (see &lt;a href="http://www.johndcook.com/blog/2009/04/28/reasons-to-use-bayesian-inference/"&gt;John's blog post for elaboration&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;John K. Kruschke made a similar argument in an &lt;a href="http://www.indiana.edu/~kruschke/AnOpenLetter.htm"&gt;Open Letter extolling the benefits of the bayesian approach&lt;/a&gt; summarised as: "(1) Scientific disciplines from astronomy to zoology are moving to Bayesian data analysis. We should be leaders of the move, not followers. (2) Modern Bayesian methods provide richer information, with greater flexibility and broader applicability than 20th century methods. Bayesian methods are intellectually coherent and intuitive. Bayesian analyses are readily computed with modern software and hardware. (3) Null-hypothesis significance testing (NHST), with its reliance on p values, has many problems. There is little reason to persist with NHST now that Bayesian methods are accessible to everyone."&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Why JAGS/BUGS rather than coding in a low-level language?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It's simpler; for models that BUGS can handle, BUGS can shield you from some of the thorny details related to numeric integration.&lt;/li&gt;
&lt;li&gt;There are simple interfaces with R.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Why JAGS rather than WinBUGS or OpenBUGS?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I'm using JAGS because it works well on Ubuntu. WinBUGS is broadly Windows specific, although I've read that it may work with the emulation software Wine.&lt;/li&gt;
&lt;li&gt;JAGS interfaces well with R. I'm comfortable writing scripts. Thus, I don't personally see the benefits of using a dedicated GUI like WinBUGS. I can leverage what I know about R.&lt;/li&gt;
&lt;li&gt;However, ultimately converting code between different flavours of BUGS is not that difficult.&lt;/li&gt;
&lt;li&gt;For further discussion of the issue, see this &lt;a href="http://r.789695.n4.nabble.com/R-vs-Bugs-td857751.html"&gt;r-help discussion&lt;/a&gt; and &lt;a href=""&gt;this discussion on CrossValidated&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;http://stats.stackexchange.com/questions/9202/openbugs-vs-jags&lt;/p&gt;

&lt;p&gt;More than anything I found that JAGS provided a useful entry point into the world of Bayesian modelling. This in turn appealed to me for several reasons:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; Even when I perform analyses using an NHST approach I often intuitively think of empirical research questions in terms of probability densities on a parameter of interest that changes as empirical and theoretical evidence is accumulated. See for example Thompson's (2002) concept of &lt;a href="http://www.reference.com/browse/meta-analytic_thinking"&gt;meta-analytic thinking&lt;/a&gt;. Bayesian analysis provides tools for formalising this orientation.&lt;/li&gt;
&lt;li&gt; More broadly, I appreciate the explicitness that a Bayesian approach requires and encourages. E.g., specifying the distribution of the error term, specifying a prior, specifying the distribution of parameters in a mixed effects model, and so on.&lt;/li&gt;
&lt;li&gt; There are several modelling challenges that I'm currently working through where a Bayesian approach offers substantial flexibility and applicability. In particular, I'm interested in modelling individual differences in the effect of practice on strategy use and task performance and then relating these individual differences to factors like intelligence, prior experience, and personality.&lt;/li&gt;
&lt;/ol&gt;


&lt;h3&gt;JAGS Installation&lt;/h3&gt;

&lt;p&gt;JAGS runs on Linux, Mac, and Windows. I run JAGS on Ubuntu through an interface with R called &lt;code&gt;rjags&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The following sets out a basic installation process:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; If necessary &lt;a href="http://www.r-project.org/"&gt;Download and install R&lt;/a&gt; and potentially a user interface to R like &lt;a href="http://rstudio.org/"&gt;R Studio&lt;/a&gt; (see &lt;a href="http://jeromyanglim.blogspot.com.au/2009/06/learning-r-for-researchers-in.html"&gt;here for tips on getting started with R&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt; &lt;a href="http://mcmc-jags.sourceforge.net/"&gt;Download and install JAGS&lt;/a&gt; as per operating system requriements.&lt;/li&gt;
&lt;li&gt; Install additional R packages: e.g., in R &lt;code&gt;install.packages("rjags")&lt;/code&gt; . In particular, I use the packages &lt;code&gt;rjags&lt;/code&gt; to interface with JAGS and &lt;code&gt;coda&lt;/code&gt; to process MCMC output.&lt;/li&gt;
&lt;/ol&gt;


&lt;h3&gt;Information on JAGS&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The &lt;a href="http://sourceforge.net/projects/mcmc-jags/files/Manuals/"&gt;manual for different versions of JAGS is located here&lt;/a&gt;. e.g., &lt;a href="http://ftp.iinet.net.au/pub/FreeBSD/distfiles/mcmc-jags/jags_user_manual.pdf"&gt;the pdf of the manual for 3.1.0&lt;/a&gt;. Several particularly relevant sections include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the list of supported distributions and how they are parameterised. This is often important given that the code looks similar to R but often uses different parameterisation (e.g., precision is used instead of standard deviation for a normal distribution).&lt;/li&gt;
&lt;li&gt;It summarises differences between WinBUGS and JAGS.&lt;/li&gt;
&lt;li&gt;It sets out available functions and operators.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The &lt;a href="http://cran.r-project.org/web/packages/rjags/rjags.pdf"&gt;&lt;code&gt;rjags&lt;/code&gt; help pdf&lt;/a&gt; for information about how to interface with JAGS from R.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://martynplummer.wordpress.com/"&gt;Martin Plummer has a blog called JAGS NEWS&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;The &lt;a href=""&gt;Bayesian Task View on CRAN&lt;/a&gt; lists and briefly describes the many R packages related to Bayesian statistics.&lt;/li&gt;
&lt;li&gt;Lunn and colleagues have a 2009 article called &lt;a href=""&gt;The BUGS project: Evolution, critique and future directions&lt;/a&gt;. It provides a useful historical perspective on the broader BUGS project, although it does not mention much about JAGS specifically.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;http://cran.r-project.org/web/views/Bayesian.html
http://www.stat.columbia.edu/~gelman/bayescomputation/lunnbugswithcomments.pdf&lt;/p&gt;

&lt;h3&gt;Examples JAGS Scripts&lt;/h3&gt;

&lt;p&gt;I find it easier to pick up a new language by playing with examples. The following provides links to example JAGS code, often with accompanying explanations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Justin Esarey

&lt;ul&gt;
&lt;li&gt;An entire course on &lt;a href="http://jee3.web.rice.edu/teaching.htm"&gt;Bayesian Statistics&lt;/a&gt; with examples in R and JAGS.   It includes 10 lectures and each lecture lasts around 2 hours. The content is designed for a social science audience and it includes a syllabus linking with Simon Jackman's text. The videos are linked from above or available direclty on &lt;a href="http://www.youtube.com/playlist?list=PLAFC5F02F224FA59F"&gt;YouTube&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;John Myles White&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A course on statistical models that is under development with &lt;a href="https://github.com/johnmyleswhite/JAGSExamples"&gt;JAGS scripts on github&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;A &lt;a href="http://www.johnmyleswhite.com/notebook/2011/03/16/canabalt-revisited-gamma-distributions-multinomial-distributions-and-more-jags-goodness/"&gt;model of Cannabalt scores using a gamma distribution&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.johnmyleswhite.com/notebook/2010/08/20/using-jags-in-r-with-the-rjags-package/"&gt;Simple introductory examples of fitting a normal distribution, linear regression, and logistic regression&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;A follow-up post demonstrating the use of the &lt;code&gt;coda&lt;/code&gt; package with &lt;code&gt;rjags&lt;/code&gt; to &lt;a href="http://www.johnmyleswhite.com/notebook/2010/08/29/mcmc-diagnostics-in-r-with-the-coda-package/"&gt;perform MCMC diagnostics&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;John K. Kruschke&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;John Krushke wrote a book called &lt;em&gt;Doing Bayesian Data Analysis: A Tutorial with R and BUGS&lt;/em&gt;. It's an excellent entry point into the world of Bayesian statistics for the social and behavioural scientist who has reasonable quantiative training, but is not necessarily ready to absorb the kinds of books that are used in graduate-level statistics courses.&lt;/li&gt;
&lt;li&gt;The &lt;a href="http://www.indiana.edu/~kruschke/DoingBayesianDataAnalysis/"&gt;book has a website&lt;/a&gt; that provides all the examples used in the book all the examples used in the book. See this &lt;a href="http://doingbayesiandataanalysis.blogspot.com.au/2012/01/complete-steps-for-installing-software.html"&gt;blog post for a link to the zip file containing the JAGS code&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;BUGS Project&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;BUGS is well known for the large set of examples that accompany the project.&lt;/li&gt;
&lt;li&gt;The PDF providing documentation for Volume 1 and 2 of the examples is &lt;a href="http://www.mrc-bsu.cam.ac.uk/bugs/documentation/contents.shtml"&gt;available here&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;You can see the &lt;a href="http://sourceforge.net/projects/mcmc-jags/files/Examples/2.x/"&gt;JAGS code used to run these examples here&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Patrick J Mineault&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;An &lt;a href="http://xcorr.net/2011/07/13/gibbs-sampling-made-easy-jags-rkward-coda/"&gt;example from Gelman et al examining the effect of training programs on SAT scores&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Miguel Lobo&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://sousalobo.com/aom2011pdw/JAGS_tutorial_Lobo.pdf"&gt;A short tutorial&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Simon Jackman&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Simon Jackman wrote the book &lt;em&gt;Bayesian Analysis for the Social Sciences&lt;/em&gt; that has accompanying JAGS code.&lt;/li&gt;
&lt;li&gt;The &lt;a href="http://jackman.stanford.edu/MCMC/"&gt;book's website&lt;/a&gt; has several useful resources including example papers using Bayesian methods.&lt;/li&gt;
&lt;li&gt;An &lt;a href="http://jackman.stanford.edu/classes/BASS/index.php"&gt;associated course&lt;/a&gt; that uses the book as a text book has slides and many examples of using and R and JAGS.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Johannes Karreth&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A &lt;a href="http://jkarreth.myweb.uga.edu/bayes2011.htm"&gt;course on applied bayesian modelling&lt;/a&gt; with examples of data, and code using the &lt;code&gt;R2jags&lt;/code&gt; interface.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Myself&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I also plan to post a few examples in upcoming blog posts. I typically will share the code for these on my &lt;a href="https://github.com/jeromyanglim"&gt;github account: &lt;code&gt;jeromyanglim&lt;/code&gt;&lt;/a&gt;. If you are reading this through syndication you may wish to &lt;a href="http://feeds.feedburner.com/jeromyanglim"&gt;subscribe to the RSS feed of the source blog jeromyanglim.blogspot.com&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;More broadly, examples and tutorials designed for WinBUGS can generally be adapted to be useful for JAGS. So for example, you can explore these WinBUGS examples:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Michael Lee and Eric-Jan Wagemakers have a free online book called &lt;em&gt;A Course in Bayesian Graphical Modeling for Cognitive Science&lt;/em&gt;: see &lt;a href="http://www.ejwagenmakers.com/BayesCourse/BayesBookWeb.pdf"&gt;PDF&lt;/a&gt; and &lt;a href="http://www.ejwagenmakers.com/BayesCourse/BayesBook.html"&gt;website&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;The website for the book &lt;a href="http://www.dme.ufrj.br/mcmc/"&gt;Markov Chain Monte Carlo&lt;/a&gt; has several WinBUGS examples.&lt;/li&gt;
&lt;li&gt;There is an &lt;a href="http://www.mrc-bsu.cam.ac.uk/bugs/weblinks/webresource.shtml"&gt;extensive list of BUGS resources&lt;/a&gt; on the BUGS project website.&lt;/li&gt;
&lt;/ul&gt;


&lt;h3&gt;Asking questions&lt;/h3&gt;

&lt;p&gt;There are several places to ask questions about JAGS, R, and Bayesian statistics.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://stats.stackexchange.com/questions/tagged/jags"&gt;JAGS&lt;/a&gt;, &lt;a href="http://stats.stackexchange.com/questions/tagged/bugs"&gt;BUGS&lt;/a&gt;, and &lt;a href="http://stats.stackexchange.com/questions/tagged/bayesian"&gt;bayesian&lt;/a&gt; questions on &lt;a href="http://stats.stackexchange.com/"&gt;stats.stackexchange.com&lt;/a&gt; (aka CrossValidated).&lt;/li&gt;
&lt;li&gt;&lt;a href="http://sourceforge.net/projects/mcmc-jags/forums/"&gt;JAGS discussion forum&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;There's also a &lt;a href="http://www.mrc-bsu.cam.ac.uk/bugs/overview/list.shtml"&gt;BUGS discussion list&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;In general, I prefer the Stack Exchange model for asking and answering questions on the internet, although the most important issue is typically where the experts are located.&lt;/p&gt;

&lt;h3&gt;Interesting Psychological Applications of Bayesian Modelling&lt;/h3&gt;

&lt;p&gt;If you want to see some examples of Bayesian modelling applied to psychological data, I found the following articles quite interesting. PDFs are available online.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://homepage.psy.utexas.edu/homepage/group/loveLAB/love/classes/CompCogsci/2010/hierarchicalReview.pdf"&gt;Shiffrin, Lee, Kim, and Wagenmakers (2008, PDF)&lt;/a&gt; present a tutorial on hierarchical bayesian methods in the context of cognitive science.&lt;/li&gt;
&lt;li&gt;&lt;a href="http://cear.gsu.edu/workshops/8/CEAR%20dec%201-2%20papers/Lee/Lee2011.pdf"&gt;Michael Lee (2011, PDF) in Journal of Mathematical Psychology&lt;/a&gt; discusses the benefits of hiearchical Bayesian methods to modelling psychological data and provides several example applications.&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.newcl.org/docs/2011/averell_heathcote_2011.pdf"&gt;Lee Averell and Andrew Heathcote (2010, PDF)&lt;/a&gt; in Journal of Mathematical Psychology analyse individual differences in the forgetting curve using a hierarchical Bayesian approach.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;If you know of any other interesting JAGS resources or have any comments about my choice of software for Bayesian data analysis, feel free to post a comment.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=6XpJ248trHA:2twRalQbmxM:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=6XpJ248trHA:2twRalQbmxM:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=6XpJ248trHA:2twRalQbmxM:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=6XpJ248trHA:2twRalQbmxM:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=6XpJ248trHA:2twRalQbmxM:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=6XpJ248trHA:2twRalQbmxM:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=6XpJ248trHA:2twRalQbmxM:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=6XpJ248trHA:2twRalQbmxM:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=6XpJ248trHA:2twRalQbmxM:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/jeromyanglim/~4/6XpJ248trHA" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://jeromyanglim.blogspot.com/feeds/2161909575284784854/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://jeromyanglim.blogspot.com/2012/04/getting-started-with-jags-rjags-and.html#comment-form" title="10 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8909074830238091680/posts/default/2161909575284784854?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8909074830238091680/posts/default/2161909575284784854?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/jeromyanglim/~3/6XpJ248trHA/getting-started-with-jags-rjags-and.html" title="Getting Started with JAGS, rjags, and Bayesian Modelling" /><author><name>Jeromy Anglim</name><uri>https://plus.google.com/100803004599943057656</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-xUmT1aa-RI0/AAAAAAAAAAI/AAAAAAAAAvk/eN47FjC3uVU/s512-c/photo.jpg" /></author><thr:total>10</thr:total><feedburner:origLink>http://jeromyanglim.blogspot.com/2012/04/getting-started-with-jags-rjags-and.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkYFR348eip7ImA9WhRaFEo.&quot;"><id>tag:blogger.com,1999:blog-8909074830238091680.post-3324860562942638158</id><published>2012-02-17T21:21:00.000+11:00</published><updated>2012-02-17T21:21:56.072+11:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-02-17T21:21:56.072+11:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="psychology" /><category scheme="http://www.blogger.com/atom/ns#" term="stackexchange" /><title>New Psychology and Cognitive Science Question and Answer Site: COGSCI.SE</title><content type="html">&lt;p&gt;There is now a new website for researchers to ask and answer
questions on topics related to psychology and cognitive science.
The site is &lt;a href="http://cogsci.stackexchange.com/"&gt;cogsci.stackexchange.com&lt;/a&gt;.
From the success of earlier released &lt;a href="http://stackexchange.com/sites"&gt;sites in the Stack Exchange
network&lt;/a&gt; such as those on 
&lt;a href="http://stackoverflow.com/"&gt;programming&lt;/a&gt;, 
&lt;a href="http://stats.stackexchange.com/"&gt;statistics&lt;/a&gt;, 
and &lt;a href="http://tex.stackexchange.com/"&gt;latex&lt;/a&gt;,
the site for psychology and cognitive science has the potential be a great
resource for researchers.
&lt;a href="http://cogsci.stackexchange.com/users/52/jeromy-anglim"&gt;I'm actively
contributing&lt;/a&gt; on the site.
So, if you are a researcher in psychology, I hope you'll &lt;a href="http://cogsci.stackexchange.com/"&gt;check it
out&lt;/a&gt;.
The rest of this post sets out 
(a) a little history of Stack Exchange question and answer sites as they relate to psychology and statistics; 
(b) why I think this &lt;a href="http://cogsci.stackexchange.com/"&gt;new site for psychology and cognitive science&lt;/a&gt;
has so much potential; and
(c) why, if you are a professional or student researcher in psychology, you
might want to get involved.&lt;/p&gt;

&lt;a name='more'&gt;&lt;/a&gt;

&lt;h3&gt;A little history&lt;/h3&gt;

&lt;p&gt;I first learnt about the Stack Exchange network back in 2009. 
While I was busy learning R, a number of people in the online data science world 
such as &lt;a href="http://www.cerebralmastication.com/"&gt;JD Long&lt;/a&gt;, 
&lt;a href="http://www.oscon.com/oscon2009/public/schedule/detail/10432"&gt;Michael Driscoll&lt;/a&gt;,
&lt;a href="http://www.drewconway.com/zia/?p=1172"&gt;Drew Conway&lt;/a&gt;, and &lt;a href="https://twitter.com/#!/rstatsmob/following"&gt;many
more&lt;/a&gt; were promoting a programmer's
question and answer site called Stack Overflow as a place to ask and answer R
related questions.
It was a site pitched at overcoming the many problems of discussion boards,
mailing lists, and the like: e.g., off topic threads, spam, extended discussion
difficulty finding the correct answers, poor indexing by Google, etc.
As of Feb 2011, it now has over &lt;a href="http://stackoverflow.com/questions/tagged/r?sort=votes&amp;amp;pagesize=50"&gt;10,000 questions with the R
tag&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Shortly afterwards, the Stack Exchange Network developed &lt;a href="http://area51.stackexchange.com"&gt;Area51&lt;/a&gt;.
The idea was to take the question and answer infrastructure that made Stack
Overflow a success in the programming world, and extend it to all sorts of other
domains.
Instead of going down the model of Quora or, shudder to think, Yahoo Answers,
Stack Exchange did not permit the creation of a site until a sufficient
community of active users existed to maintain the site at a high standard.
Thus, my main interests, statistics and psychology were going to have to wait.&lt;/p&gt;

&lt;p&gt;A site for statistics questions was the first to join the network
(&lt;a href="http://stats.stackexchange.com/"&gt;stats.stackexchange.com&lt;/a&gt;).
&lt;a href="http://robjhyndman.com/researchtips/crossvalidated/"&gt;Professor Rob Hyndman proposed the
site&lt;/a&gt;, and perhaps given the
overlapping worlds of programmers and data analysts, the
site launched a few months later in July 2010.
At the time of posting it has over &lt;a href="http://stats.stackexchange.com/questions?sort=votes"&gt;7,000
questions&lt;/a&gt;.
&lt;a href="http://stats.stackexchange.com/users/183/jeromy-anglim"&gt;I've been actively involved&lt;/a&gt; in the site.
I've used it to get advice on my own research.
I've also used it extensively in various statistical consulting roles.
In particular, I've &lt;a href="http://jeromyanglim.blogspot.com.au/2011/03/how-to-ask-me-statistics-question.html"&gt;encouraged others who would otherwise send me an email about
statistics, to post the question on
stats.se&lt;/a&gt;
so that any answer can be an ongoing resource for others.&lt;/p&gt;

&lt;p&gt;In the case of psychology and cognitive science, I've had to wait a lot longer.
The overlap between programming and psychology communities is much smaller,
and site proposals were split over separate cognitive science, psychology, and
psychiatry proposals.
Finally, in December 2011 these three proposals were merged and on January 19th 2012 the
site was launched in Beta under the title Cognitive Sciences at the url
&lt;a href="http://cogsci.stackexchange.com/"&gt;cogsci.stackexchange.com&lt;/a&gt;.
Although the initial name is suggestive of a focus on "cognitive" science. 
The history of the merging of site proposals, the inclusion of the "s", plural
"sciences", and the attitude of current participants admits the full range of
questions in cognitive science, psychology, and psychiatry.&lt;/p&gt;

&lt;p&gt;At the time of posting the site is growing at a healthy rate. 
Most questions are getting good answers, and the community norms around question
quality, references, scope and so on are being clarified on the &lt;a href="http://meta.cogsci.stackexchange.com/"&gt;meta
site&lt;/a&gt;.
However, there is also the challenge of getting the word out about the site to
academics, researchers, and graduate students who are not otherwise familiar
with the Stack Exchange network of sites.
In my opinion, Stack Exchange provides the best currently available
infrastructure for building a high quality question and answer site. 
However, it still relies on a community of expert contributors.&lt;/p&gt;

&lt;p&gt;So, if you're a researcher in psychology or cognitive science, why might you
want to get involved? And why might you want to talk to fellow researchers about
the?&lt;/p&gt;

&lt;h3&gt;Reasons to participate as an academic&lt;/h3&gt;

&lt;p&gt;If you are an academic, Lecturer, or Post Doc, there are many reasons why you
might want to participate:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Answering questions is a way of facilitating knowledge transfer to the
broader community; this can be intrinsically enjoyable especially when you get direct
feedback on the number of people who read your answers.&lt;/li&gt;
&lt;li&gt;If you use your own name, as many people do, the voting and reputation system,
and various other mechanisms provide a means for your contribution to be
recognised.&lt;/li&gt;
&lt;li&gt;You get immediate feedback on what others think of your answers; Thus, it
creates an environment of feedback conducive to learning.&lt;/li&gt;
&lt;li&gt;I see sites like Stack Exchange as part of a broader model of open science.
As you create and develop knowledge, you encounter challenges. The idea is to
record these challenges as questions and then add the resolutions as answers.
Thus, when others encounter the same problems, good answers are only a Google
search away.
I'm not saying that question and answer sites replace journal articles, but
they can fill a bridging role linking the language of questions to the answers
provided in journal articles.&lt;/li&gt;
&lt;li&gt;Furthermore, the content on Stack Exchange is licenced under creative commons,
so even if the site disappeared the content would still be available on other
sites that reproduce the material. This is much better
than the policy of almost all journals which copyright your, typically, state-sponsored
research and lock it up behind a pay wall, thereby frustrating the
process of knowledge dissemination.&lt;/li&gt;
&lt;li&gt;While contributing to Wikipedia is another great way to improve the sum of all
knowledge, unlike Wikipedia, your answers generally stay there; in contrast to
Wikipedia, where your contributions can and are often completely removed by
other editors.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Reasons to participate as a student researcher&lt;/h3&gt;

&lt;p&gt;If you are doing a thesis in psychology or cognitive science, or possibly even if
you are just studying a few subjects, many of the above reasons for
participating will also apply.&lt;/p&gt;

&lt;p&gt;However, you may also find that the capacity to ask questions will be
particularly useful. As a side point, if it is early days in your career, you
may or may not want to use your real name.&lt;/p&gt;

&lt;p&gt;In particular, I'd encourage students completing a thesis to incorporate asking
and answering questions into their scholarly process.
You might encounter questions like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Is there a meta analysis on X?&lt;/li&gt;
&lt;li&gt;What are the main theory about Y?&lt;/li&gt;
&lt;li&gt;What is the best measure of Z?&lt;/li&gt;
&lt;li&gt;What is the empirical support for theory W?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These kinds of questions come up all the time when doing research.
Of course, as researchers we have strategies for finding answers ourselves.
However, the stack exchange model encourages you to learn from the answers of
others and also to "leave crumbs" so that others can follow in your footsteps
more easily. The idea is not be shy. Post questions frequently. If you're able
to answer your question, contribute a self-answer.&lt;/p&gt;

&lt;p&gt;Thus, even if only a handful of people ever read a thesis, by asking and
answering many questions along the way, resources will be left that thousands of
people will learn from and discover through Google searches in the years to
come. Even if you don't have answers, your question can be the trigger for an
expert to share knowledge to create a valuable Internet artefact.&lt;/p&gt;

&lt;h5&gt;Getting Started&lt;/h5&gt;

&lt;p&gt;If you want to learn more or give the site a go:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Have a read through the &lt;a href="http://cogsci.stackexchange.com/faq"&gt;FAQ on cogsci.se&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://cogsci.stackexchange.com/questions/ask"&gt;Ask a question&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;See if you can answer one of the &lt;a href="http://cogsci.stackexchange.com/unanswered"&gt;currently unanswered
questions&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I'm &lt;a href="http://cogsci.stackexchange.com/users/52/jeromy-anglim"&gt;floating around on the
site&lt;/a&gt;, so if you're a
researcher in psychology, I hope to see you
&lt;a href="http://cogsci.stackexchange.com/"&gt;there&lt;/a&gt;.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=zB1_AtXJgHU:am6tH0Mo9MY:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=zB1_AtXJgHU:am6tH0Mo9MY:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=zB1_AtXJgHU:am6tH0Mo9MY:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=zB1_AtXJgHU:am6tH0Mo9MY:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=zB1_AtXJgHU:am6tH0Mo9MY:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=zB1_AtXJgHU:am6tH0Mo9MY:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=zB1_AtXJgHU:am6tH0Mo9MY:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=zB1_AtXJgHU:am6tH0Mo9MY:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=zB1_AtXJgHU:am6tH0Mo9MY:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/jeromyanglim/~4/zB1_AtXJgHU" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://jeromyanglim.blogspot.com/feeds/3324860562942638158/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://jeromyanglim.blogspot.com/2012/02/new-psychology-and-cognitive-science.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8909074830238091680/posts/default/3324860562942638158?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8909074830238091680/posts/default/3324860562942638158?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/jeromyanglim/~3/zB1_AtXJgHU/new-psychology-and-cognitive-science.html" title="New Psychology and Cognitive Science Question and Answer Site: COGSCI.SE" /><author><name>Jeromy Anglim</name><uri>https://plus.google.com/100803004599943057656</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-xUmT1aa-RI0/AAAAAAAAAAI/AAAAAAAAAvk/eN47FjC3uVU/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://jeromyanglim.blogspot.com/2012/02/new-psychology-and-cognitive-science.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUEFR3Y-eSp7ImA9WhdSFU0.&quot;"><id>tag:blogger.com,1999:blog-8909074830238091680.post-5256105903569404178</id><published>2011-07-24T21:40:00.000+10:00</published><updated>2011-07-24T21:40:16.851+10:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-07-24T21:40:16.851+10:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="I/O Psych" /><category scheme="http://www.blogger.com/atom/ns#" term="academia" /><title>Tips for Undergraduates Interested in a Career in Organisational Psychology: Australian Perspective</title><content type="html">&lt;p&gt;Undergraduate psychology students often ask me about careers in organisational
psychology.
This post aims to provide a few links and resources to assist such students to
learn about the profession and the career pathways.
The post includes (a) a basic description of organisational psychology, (b)
links to Australian educational and professional society resources, (c)
discussion of PhD and academic options, and (d) additional resources to learn
more about the profession.&lt;/p&gt;

&lt;a name='more'&gt;&lt;/a&gt;

&lt;h3&gt;Overview of Organisational Psychology&lt;/h3&gt;

&lt;h4&gt;What is the profession called?&lt;/h4&gt;

&lt;p&gt;Before discussing the profession some consideration should be given to what to
call it.
'Organisational psychology' goes by various names and abbreviations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Organisational Psychology (Org Psych) &lt;/li&gt;
&lt;li&gt;Industrial/Organisational Psychology (I/O or I/O Psych)&lt;/li&gt;
&lt;li&gt;Work Psychology&lt;/li&gt;
&lt;li&gt;Occupational Psychology &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Different names imply both historical and present differences in focus. 
However, such terms are also often used interchangeably. 
See &lt;a href="
http://www.siop.org/userfiles/file/What's%20In%20A%20Name.pdf"&gt;SIOP's 'What's in a Name?'&lt;/a&gt;
article for an overview of various job titles.&lt;/p&gt;

&lt;p&gt;Names vary by region.
In the United States, "I/O" is preferred. 
In Australia, "Organisational Psychology" is arguably the more common term,
consistent with the APS college name and many course names.
Thus, I'll tend to use this term in this post.&lt;/p&gt;

&lt;h4&gt;What is organisational psychology?&lt;/h4&gt;

&lt;p&gt;Here are a few descriptions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;"Organisational Psychology is the science of people at work.  Organisational
psychologists specialise in analysing organisations and their people, and
devising strategies to recruit, motivate, develop, change and inspire." -
&lt;a href="
http://www.groups.psychology.org.au/Assets/Files/COP%20AGM%202008%20Reports.pdf
"&gt;prize winning elevator pitch (APS COP) &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Industrial / Organisational psychologists "Apply principles of psychology to
personnel, administration, management, sales, and marketing problems.
Activities may include policy planning; employee screening, training and
development; and organizational development and analysis.  May work with
management to reorganize the work setting to improve worker productivity. -
&lt;a href="
http://online.onetcenter.org/link/summary/19-3032.00"&gt;Industrial/Organisational Psychologist job description on O*N&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;"Industrial-organizational (I-O) psychology is the scientific study of the
workplace. Rigor and methods of psychology are applied to issues of critical
relevance to business, including talent management, coaching, assessment,
selection, training, organizational development, performance, and work-life
balance." - &lt;a href="http://www.siop.org/studentdefault.aspx"&gt;SIOP: Student Section&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The APS College of Organisational Psychology has a page that describes &lt;a href="
http://www.groups.psychology.org.au/cop/about_us/org_psychologists/"&gt;"What is an
organisational psychologist" and "Areas of Specialisation"&lt;/a&gt;.&lt;/p&gt;

&lt;h4&gt;Learning more about the profession:&lt;/h4&gt;

&lt;p&gt;A good strategy for learning more about the profession is to browse the various
society pages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="
http://www.siop.org/default.aspx"&gt;SIOP - Division of the American Psychological Association&lt;/a&gt;: The United States is huge; and I/O
is huge in the United States. The SIOP web page has heaps of
useful online resources.&lt;/li&gt;
&lt;li&gt;&lt;a href="
http://www.bps.org.uk/dop/"&gt;Division of Occupational Psychology: British Psychological Society&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="
http://www.groups.psychology.org.au/cop/"&gt;Australian Psychological Society: College of Organisational Psychologists&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Organisational Psychology in Australia&lt;/h3&gt;

&lt;h4&gt;Registration&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;"Psychologist" is a regulated term in Australia. 
It is illegal to call yourself a psychologist, if you are not appropriately registered.&lt;/li&gt;
&lt;li&gt;Pathways to registration are set out by the &lt;a href="
http://www.psychologyboard.gov.au/"&gt;Psychology Board of Australia&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;The traditional pathway for registration has involved first completing a four
year accredited undergraduate psychology sequence, followed by either two
years of supervised practice or the completion of an accredited post-graduate
program (e.g., Masters, Doctorate, Masters / PhD).
Over recent years, rules for registration have been changing. 
So, make sure you do your own research.&lt;/li&gt;
&lt;li&gt;I should also mention that even if you can't call yourself a "psychologist",
completing an undergraduate major in psychology, particularly one with honours
in psychology (and perhaps also an undergraduate
subject in organisational psychology) can open doors to many roles related to
organisational psychology (e.g., HR, selection and recruitment,
marketing research, etc.).&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Finding organisational psychology university programs in Australia:&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;a href="http://www.apac.psychology.org.au/"&gt;APAC accreditation site&lt;/a&gt; lists
approved postgraduate psychology programs. &lt;/li&gt;
&lt;li&gt;To find organisational psychology courses, last I checked, the following
worked
&lt;ul&gt;
&lt;li&gt;Click &lt;a href="
http://www.apac.psychology.org.au/Courses.aspx?ID=1045"&gt;Search for courses - Australia&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Click on the State you want to search for&lt;/li&gt;
&lt;li&gt;Search for "&lt;code&gt;org&lt;/code&gt;"&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Groups and networking opportunities&lt;/h4&gt;

&lt;p&gt;&lt;a href="
http://www.groups.psychology.org.au/cop/"&gt;The Australian Psychological Society: College of Organisational Psychologists&lt;/a&gt; is the main group representing
organisational psychologists in Australia. &lt;br /&gt;
It is made up of various state branches. &lt;br /&gt;
The society sometimes runs sessions suited to students wanting to
learn more (e.g., careers fairs).&lt;/p&gt;

&lt;p&gt;A few informal online groups are also good places to learn more about the
profession in Australia. Both welcome professionals and students:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Facebook group: &lt;a href="http://www.facebook.com/group.php?gid=2355243978"&gt;Organisational Psychology in
Australia&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;LinkedIn group: &lt;a href="http://www.linkedin.com/groups?home=&amp;amp;gid=147918&amp;amp;trk=anet_ug_hm"&gt;Organisational Psychology in
Australia&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Salary Surveys&lt;/h4&gt;

&lt;p&gt;There are many reasons to find a career in organisational psychology
intellectually stimulating and meaningful.
There has also often been financial reasons to find it attractive:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="
http://www.groups.psychology.org.au/Assets/Files/Salary_Survey_exec_summary.pdf"&gt;Australia: A slightly dated 2006 APS COP Salary survey&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.siop.org/surveys.aspx"&gt;United States: SIOP Salary surveys&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;A career in academia&lt;/h3&gt;

&lt;h4&gt;PhD on a topic related to organisational psychology or related area&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Doing a PhD on a topic related to organisational psychology can create
many opportunities.
Such a PhD can open up doors to academic positions in a wide range of
departments including, psychology, HRM, management, business, and so on.
The solid background in statistics and research methods provides a
particular advantage for an academic career.
Of course, academic positions are competitive and generally require a good
publication track record.&lt;/li&gt;
&lt;li&gt;Choosing a good PhD supervisor is important.
In addition to supervisors in departments that offer organisational psychology
programs, it's possible to look at supervisors in departments and universities
that don't offer such programs.&lt;/li&gt;
&lt;li&gt;The skills learnt can also readily be applied in many social science research
related roles in industry.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Examples of eminent organisational psychology academics&lt;/h4&gt;

&lt;p&gt;For those considering pursuing an academic career related to organisational
psychology, the &lt;a href="
http://www.siop.org/awardwinners.aspx"&gt;past SIOP award recipients&lt;/a&gt;,
particularly in the categories Distinguished Scientific Contribution, and
Distinguished Early Career Contribution, provide motivating examples of
successful I/O psychology researchers.&lt;/p&gt;

&lt;h4&gt;Example academic websites&lt;/h4&gt;

&lt;p&gt;The following links point to examples of successful academics in I/O psychology. &lt;br /&gt;
I also selected these particular pages because each one provides PDFs for many
of the respective academic's publications.
This can give a flavour of the kind of work, focus, and specialisation that an
academic in I/O might engage in.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://users.ugent.be/~flievens/"&gt;Filip Lievens&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.bsos.umd.edu/psyc/gelfand/research.html"&gt;Michele Gelfand&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://iopsych.msu.edu/koz/main.htm"&gt;Steve Kozlowski&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.krannert.purdue.edu/directory/publications.asp?id=7090"&gt;Michael Campion&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.management.wharton.upenn.edu/grant/"&gt;Adam Grant&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://people.tamu.edu/~mbarrick/pubs.htm"&gt;Murray Barrick&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Journals to read&lt;/h4&gt;

&lt;p&gt;Further understanding of the research done in organisational psychology and
related disciplines can be gained from reading some of the core journals.
A good starting point can be gained by perusing 
&lt;a href="
http://www.siop.org/tip/backissues/TipApr01/03Zicker.aspx"&gt;the following ranked list of journals generated by Michael Zickar and Scott
Highhouse&lt;/a&gt; back in
2001 based on a survey of SIOP members:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Journal of Applied Psychology&lt;/li&gt;
&lt;li&gt;Personnel Psychology&lt;/li&gt;
&lt;li&gt;Academy of Management Journal&lt;/li&gt;
&lt;li&gt;Academy of Management Review&lt;/li&gt;
&lt;li&gt;Organizational Behavior and Human Decision Processes&lt;/li&gt;
&lt;li&gt;Administrative Science Quarterly&lt;/li&gt;
&lt;li&gt;Journal of Management&lt;/li&gt;
&lt;li&gt;Journal of Organizational Behavior&lt;/li&gt;
&lt;li&gt;Organizational Research Methods&lt;/li&gt;
&lt;li&gt;Journal of Vocational Behavior&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;Additional Resources&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Richard Landers has a series of posts providing advice on pursuing a career in
I/O psychology from the U.S. perspective: 
&lt;ul&gt;
&lt;li&gt;&lt;a href="
http://neoacademic.com/2011/06/14/grad-school-should-i-get-a-ph-d-or-masters-in-io-psychology/"&gt;PhD or Masters in I/O&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href="http://neoacademic.com/2011/07/19/grad-school-prepping-for-the-gre/"&gt;Prepping for the GRE&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href="http://neoacademic.com/io-blogosphere/"&gt;He also lists other I/O Blogs&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.siop.org/tip/tip.aspx"&gt;TIP&lt;/a&gt; is the official newsletter of SIOP.
Current and back issues are available online and provide a good insight into
the profession including the interface between professional practice and
scientific research.&lt;/li&gt;
&lt;/ul&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=esBcKcl5u5c:Q0sUuWnAXqM:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=esBcKcl5u5c:Q0sUuWnAXqM:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=esBcKcl5u5c:Q0sUuWnAXqM:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=esBcKcl5u5c:Q0sUuWnAXqM:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=esBcKcl5u5c:Q0sUuWnAXqM:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=esBcKcl5u5c:Q0sUuWnAXqM:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=esBcKcl5u5c:Q0sUuWnAXqM:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=esBcKcl5u5c:Q0sUuWnAXqM:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=esBcKcl5u5c:Q0sUuWnAXqM:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/jeromyanglim/~4/esBcKcl5u5c" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://jeromyanglim.blogspot.com/feeds/5256105903569404178/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://jeromyanglim.blogspot.com/2011/07/tips-for-undergraduates-interested-in.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8909074830238091680/posts/default/5256105903569404178?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8909074830238091680/posts/default/5256105903569404178?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/jeromyanglim/~3/esBcKcl5u5c/tips-for-undergraduates-interested-in.html" title="Tips for Undergraduates Interested in a Career in Organisational Psychology: Australian Perspective" /><author><name>Jeromy Anglim</name><uri>https://plus.google.com/100803004599943057656</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-xUmT1aa-RI0/AAAAAAAAAAI/AAAAAAAAAvk/eN47FjC3uVU/s512-c/photo.jpg" /></author><thr:total>2</thr:total><feedburner:origLink>http://jeromyanglim.blogspot.com/2011/07/tips-for-undergraduates-interested-in.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D08GR3s9fyp7ImA9WhdTGU0.&quot;"><id>tag:blogger.com,1999:blog-8909074830238091680.post-4431550921349913034</id><published>2011-07-17T22:30:00.000+10:00</published><updated>2011-07-17T22:30:26.567+10:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-07-17T22:30:26.567+10:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="SPSS" /><category scheme="http://www.blogger.com/atom/ns#" term="correlation" /><category scheme="http://www.blogger.com/atom/ns#" term="causation" /><category scheme="http://www.blogger.com/atom/ns#" term="R" /><title>Correlation Resources: SPSS, R, Causality, Interpretation, and APA Style Reporting</title><content type="html">&lt;p&gt;This post provides links to a range of resources related to the use and
interpretation of correlations.
I wanted to provide a page with links to a number of additional resources that
would be useful both for those of my students who might be keen to learn more
and for anyone else who might be interested.
Specifically, this post provides links to:
(a) introductory book-style chapters on correlation,
(b) resources related to assorted issues in correlation (i.e., discussion of
causal inference, correlation with various variable types, range restriction,
statistical power, correlation interpretation, and significance testing),
(c) tutorials on computing correlations using SPSS and R, and
(d) tips for reporting correlations in APA Style.&lt;/p&gt;

&lt;a name='more'&gt;&lt;/a&gt;     

&lt;h3&gt;Introductions to correlation&lt;/h3&gt;

&lt;p&gt;The following provide general textbook style overviews of correlation:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="
http://davidakenny.net/statbook/chapter_16.pdf"&gt;David Kenny's Chapter 16 Testing Measures of Association&lt;/a&gt; provides a textbook overview
of correlation designed for psychology undergraduate students. 
It also includes several practice questions.
David Kenny has kindly made his &lt;a href="
http://davidakenny.net/statbook/"&gt;entire textbook 'Statistics for the Social
and Behavioral Sciences' available online for free&lt;/a&gt; as either an &lt;a href="http://davidakenny.net/statbook/kenny87.pdf"&gt;overall pdf&lt;/a&gt; or 
&lt;a href="http://davidakenny.net/statbook/"&gt;individual chapters&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href="
http://www.psychstat.missouristate.edu/introbook/sbk17m.htm"&gt;David Stockburger's Introductory Statistics chapter on Correlation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="
http://web.psych.unimelb.edu.au/jkanglim/correlationandreggression.pdf"&gt;My own slides and notes on correlation&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Assorted Issues&lt;/h3&gt;

&lt;h4&gt;Correlation and Causation&lt;/h4&gt;

&lt;p&gt;Knowing how to reason about causality in the behavioural and social sciences is
a really important skill.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Check out &lt;a href="
http://jeromyanglim.blogspot.com/2009/10/how-to-reason-about-causes-in.html"&gt;this earlier post on correlation and causation&lt;/a&gt;
which includes links to PDFs of important journal articles on the topic.&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.youtube.com/watch?v=6RzDMEW5omc"&gt;Joy of Stats on Correlation&lt;/a&gt;
provides a 4 minute video with a few entertaining examples of correlations and
their connection with causal inference.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Types of variables&lt;/h4&gt;

&lt;p&gt;The prototypical correlation example is based on two continuous, normally
distributed variables. 
However, in practice there are many other types of variables that you might
wish to correlate.
The following provide pages provide links to suggestions for how to analyse some
other common scenarios:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="
http://stats.stackexchange.com/questions/3730/pearsons-or-spearmans-correlation-with-non-normal-data"&gt;What to do when one of the variables is non-normal?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="
http://stats.stackexchange.com/questions/8956/spearmans-or-pearsons-correlation-with-likert-scales-where-linearity-and-homosc"&gt;What to do when one of the variables is a Likert item?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="
http://jeromyanglim.blogspot.com/2009/10/analysing-ordinal-variables.html"&gt;What to do if you want to treat a variable as ordinal?&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Range restriction&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;HyperStat has a general discussion of &lt;a href="http://davidmlane.com/hyperstat/A68809.html"&gt;range
restriction&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;See this &lt;a href="http://cnx.org/content/m11196/latest/"&gt;simulation on connexions showing the effect of range
restriction&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Statistical Power&lt;/h4&gt;

&lt;p&gt;Statistical power within the context of correlation is the probability of
obtaining a statistically significant correlation in a study given that a true
correlation exists.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="
http://jeromyanglim.blogspot.com/2010/05/statistical-power-analysis-in-gpower-3.html"&gt;This earlier post&lt;/a&gt;
provides (a) some simple rules of thumb for power analysis for correlations,
(b) how to calculate statistical power using free software called G-Power,
and (c) links to additional reading on the important topic of statistical
power.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Interpretation&lt;/h4&gt;

&lt;p&gt;When I first learnt about the correlation coefficient, I found it
challenging to truly grok what a particular value meant.
Learning the standard interpretation was easy. 
The challenging part was understanding the practical and theoretical
implications for a correlation of a given size.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The following are some of the &lt;strong&gt;standard interpretations&lt;/strong&gt; of a correlation:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Pearson's correlation is an index of the direction and strength of linear
association between two variables.&lt;/li&gt;
&lt;li&gt;The square of the correlation between X and Y is the percentage of
variance shared between X and Y (e.g., if &lt;code&gt;r = .50&lt;/code&gt;, then the two variables
share &lt;code&gt;.50 * .50 = 25%&lt;/code&gt; of variance).&lt;/li&gt;
&lt;li&gt;If X and Y were standardised (i.e., made so that the mean of both
variables was zero and the standard deviation was one) then, the
correlation would be the same as the regression coefficient of X
predicting Y or Y predicting X.
Thus, for example, if &lt;code&gt;r = .25&lt;/code&gt; you could say that "a value one standard deviation
greater on X predicts a .25 standard deviation greater value on Y".&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Strategies for &lt;strong&gt;building an intuition&lt;/strong&gt; of what a correlation means:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Play with the &lt;a href="
http://www.ruf.rice.edu/~lane/stat_sim/reg_by_eye/"&gt;Regression by Eye&lt;/a&gt; simulation.
The simulation generates a scatterplot, and you are asked to indicate which of
a set of correlations corresponds to the scatterplot.
It helps to build a mapping between the graphical intuitiveness of a
scatterplot and the numeric summary of the linear association in the
scatterplot (i.e., the correlation coefficient).&lt;/li&gt;
&lt;li&gt;Memorise some of the rules of thumbs for describing correlation effect sizes
(see this &lt;a href="http://www.statisticshell.com/effectsizes.pdf"&gt;discussion by Andy
Field&lt;/a&gt;), but don't take the
rules of thumb too seriously.&lt;/li&gt;
&lt;li&gt;Try to build up a frame of reference for correlations in different contexts by
reading results sections. Meta analyses can also be particularly useful in
this regard.&lt;/li&gt;
&lt;li&gt;Read the article 'Meyer, G. J., et al (2001). Psychological Testing and Psychological
Assessment: A Review of Evidence and Issues. &lt;em&gt;American Psychologist, 56&lt;/em&gt;(2),
128-165.' (&lt;a href="https://mywebspace.wisc.edu/hmarleau/web/edwards/psychometrics/myers.pdf"&gt;PDF&lt;/a&gt;)
which provides large tables of meta-analytic correlations for a wide range of
medical and psychological domains sorted by the size of the correlation.
Studying these tables can help build an intuition and a context for
interpretation of correlations.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Graphical approaches&lt;/h4&gt;

&lt;p&gt;As with most statistical techniques, there are various ways of representing the
data. 
The correlation coefficient provides a very brief summary of the association
between two variables.
However, graphical representations of association are much richer.&lt;/p&gt;

&lt;p&gt;The following are some general heuristics that I find useful when plotting data
that might also be represented as a correlation:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use scatterplots to explore features of the association (e.g., presence of
outliers, linearity, distributional properties, spread of data around any
trend line, etc.);&lt;/li&gt;
&lt;li&gt;If one of the variables is positively skewed, consider plotting the
corresponding axis on a log scale;&lt;/li&gt;
&lt;li&gt;If there are a lot of data points (e.g., &lt;code&gt;n &amp;gt; 1000&lt;/code&gt;), adopt a different strategy
such as using some form of partial transparency (e.g., see use of the &lt;a href="http://had.co.nz/ggplot2/geom_point.html"&gt;alpha
property in ggplot2&lt;/a&gt;), or sampling
the data;&lt;/li&gt;
&lt;li&gt;If one of the variables takes on a limited number of discrete categories,
consider using a jitter or a sunflower plot;&lt;/li&gt;
&lt;li&gt;If there are three or more variables, consider using a scatterplot matrix;&lt;/li&gt;
&lt;li&gt;Fitting some form of trend line is often useful;&lt;/li&gt;
&lt;li&gt;Adjust the size of the plotting character to the sample size (for bigger n,
use a smaller plotting character).&lt;/li&gt;
&lt;/ul&gt;

 &lt;!--http://stats.stackexchange.com/questions/13148/good-online-resource-with-tips-on-graphing-association-between-two-numeric-variab--&gt;

&lt;h4&gt;Significance tests on correlations&lt;/h4&gt;

&lt;p&gt;There are a wide range of possible significance tests that can be performed on
correlations.
The following links provide some suggestions and links for different scenarios.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="
http://jeromyanglim.blogspot.com/2009/09/significance-tests-on-correlations.html"&gt;General post on comparing significance of two correlations&lt;/a&gt;
under various conditions.&lt;/li&gt;
&lt;li&gt;&lt;a href="
http://www.une.edu.au/WebStat/unit_materials/c6_common_statistical_tests/test_signif_pearson.html"&gt;Significance of correlation using Pearson's table&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Statistical Software&lt;/h3&gt;

&lt;p&gt;Calculating a correlation coefficient and its associated statistical
significance is a standard task that almost any statistical package can perform.
Many psychology students are taught to use SPSS. It is a proprietary (i.e., you
can't run it at home without a paid licence)
data analysis system with a strong empahsis on a GUI and making it easy to
perform various standardised analyses common in the social sciences.&lt;/p&gt;

&lt;p&gt;My preferred tool for performing data analysis is R.
It is open source (thus, you can run it at home for free) and is often described
as the lingua franca of statistics.  It generally requires a more sophisticated
understanding of statistics and computing to use effectively.
Thus, for the interested psychology student or researcher I have this 
&lt;a href="
http://jeromyanglim.blogspot.com/2009/06/learning-r-for-researchers-in.html"&gt;introduction to R for researchers in psychology&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Below I list resources for performing correlation analysis in SPSS and R.&lt;/p&gt;

&lt;h4&gt;SPSS&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.statisticshell.com/correlation.pdf"&gt;Andy Field has a chapter on correlation&lt;/a&gt;
which discusses correlation using SPSS. &lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.youtube.com/watch?v=loFLqZmvfzU"&gt;This video tutorial on running and interpreting a correlation analysis using
SPSS&lt;/a&gt; goes for about 7 minutes
and is elementary.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;R&lt;/h4&gt;

&lt;p&gt;R makes it easy to perform correlations on datasets.
Specifically, the following links provide example syntax:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.statmethods.net/stats/correlations.html"&gt;Quick-R on correlations&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.statmethods.net/graphs/scatterplot.html"&gt;Quick-R on scatterplots&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;More generally, William Revelle has some great resources on &lt;a href="http://personality-project.org/r/r.guide.html"&gt;R for
psychology&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Reporting Correlations in APA Style&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;APA Style Manual:&lt;/strong&gt; When required to report results using APA style, the
authoritative source is the &lt;a href="http://www.apastyle.org/"&gt;Publication Manual of the
APA&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Article Deconstruction:&lt;/strong&gt; Another general strategy is to find a journal
article that (a) reports a similar statistical test as you require, and (b)
that is published in an APA journal
or at least is in a journal that uses APA style.
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.apa.org/pubs/journals/"&gt;APA journals are listed here&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;A quick search on &lt;a href="http://scholar.google.com.au/"&gt;Google Scholar&lt;/a&gt; will
often be sufficient and quicker, although PsycInfo (a subscription
service) is more reliable if you have access to it (many universities do).
E.g., a quick search for &lt;a href="http://scholar.google.com.au/scholar?hl=en&amp;amp;q=apa+%22significant+correlation+between%22+psychology&amp;amp;btnG=Search&amp;amp;as_sdt=0%2C5&amp;amp;as_ylo=&amp;amp;as_vis=0"&gt;apa "significant correlation between"
psychology&lt;/a&gt;
revealed several relevant articles and some with immediate PDF access.&lt;/li&gt;
&lt;li&gt;I also have a separate post on this general approach of &lt;a href="
http://jeromyanglim.blogspot.com/2009/09/introduction-to-journal-article.html"&gt;deconstructing
journal articles&lt;/a&gt;
to discern writing principles.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Correlation Matrices:&lt;/strong&gt; Many psychological studies, particularly those based on
correlational/observational designs, involve the measurement of a range of
numeric variables. 
It is particularly useful, and common, in such cases to report a correlation
matrix between sets of variables. 
I have a &lt;a href="
http://jeromyanglim.blogspot.com/2009/02/formatting-correlation-matrices-in.html"&gt;post with instructions on formatting a correlation matrix&lt;/a&gt;
in APA style using a combination of SPSS, Excel, and Word. 
The post also includes links to examples of correlation matrices being
reported.&lt;/li&gt;
&lt;li&gt;&lt;a href="http://huberb.people.cofc.edu/Guide/Reporting_Statistics%20in%20Psychology.pdfs"&gt;General overview of reporting statistics including correlations using APA
style&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=OETgt2G2uBQ:-dlkvfORfnk:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=OETgt2G2uBQ:-dlkvfORfnk:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=OETgt2G2uBQ:-dlkvfORfnk:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=OETgt2G2uBQ:-dlkvfORfnk:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=OETgt2G2uBQ:-dlkvfORfnk:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=OETgt2G2uBQ:-dlkvfORfnk:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=OETgt2G2uBQ:-dlkvfORfnk:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=OETgt2G2uBQ:-dlkvfORfnk:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=OETgt2G2uBQ:-dlkvfORfnk:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/jeromyanglim/~4/OETgt2G2uBQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://jeromyanglim.blogspot.com/feeds/4431550921349913034/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://jeromyanglim.blogspot.com/2011/07/correlation-resources-spss-r-causality.html#comment-form" title="4 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8909074830238091680/posts/default/4431550921349913034?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8909074830238091680/posts/default/4431550921349913034?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/jeromyanglim/~3/OETgt2G2uBQ/correlation-resources-spss-r-causality.html" title="Correlation Resources: SPSS, R, Causality, Interpretation, and APA Style Reporting" /><author><name>Jeromy Anglim</name><uri>https://plus.google.com/100803004599943057656</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-xUmT1aa-RI0/AAAAAAAAAAI/AAAAAAAAAvk/eN47FjC3uVU/s512-c/photo.jpg" /></author><thr:total>4</thr:total><feedburner:origLink>http://jeromyanglim.blogspot.com/2011/07/correlation-resources-spss-r-causality.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0UNR3o-fSp7ImA9WhZVEU4.&quot;"><id>tag:blogger.com,1999:blog-8909074830238091680.post-6254402501596748604</id><published>2011-05-23T16:14:00.000+10:00</published><updated>2011-05-23T16:14:56.455+10:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-05-23T16:14:56.455+10:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="computers" /><category scheme="http://www.blogger.com/atom/ns#" term="vim" /><category scheme="http://www.blogger.com/atom/ns#" term="linux" /><category scheme="http://www.blogger.com/atom/ns#" term="LaTeX" /><category scheme="http://www.blogger.com/atom/ns#" term="make" /><title>Transition to Linux and Ubuntu: The Experience of a Quantitative Social Scientist</title><content type="html">&lt;p&gt;This post discusses my experience migrating to Ubuntu from Windows from the
perspective of a quantitatively oriented researcher in psychology.
It discusses (a) my general transition to open source tools for doing research;
(b) examination of Cygwin;
(c) choosing a Linux distribution;
(d) preparing for installation of Ubuntu;
(e) initial reflections on installing Ubuntu; and
(f) a long list of various solutions to specific problems that I encountered
whilst getting started with Ubuntu.&lt;/p&gt;

&lt;a name='more'&gt;&lt;/a&gt;

&lt;h3&gt;Context of transition&lt;/h3&gt;

&lt;p&gt;Anyone following this blog for a while will know that I've been progressively
migrating to using open source software for doing research.
My first foray into open source started in 2007 when I decided 
to replace SPSS with R.&lt;/p&gt;

&lt;p&gt;As is the case with many open source tools, they have a habit of mutually
reinforcing each other.
The path went something like this (with links pointing to associated blog
posts):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="
http://jeromyanglim.blogspot.com/search/label/LaTeX"&gt;LaTeX&lt;/a&gt; replaced Word as my
scientific document format.&lt;/li&gt;
&lt;li&gt;&lt;a href="
http://jeromyanglim.blogspot.com/2010/11/getting-started-with-markdown-benefits.html
"&gt;Markdown replaced Word&lt;/a&gt;
as my document format for note taking and informal documents.&lt;/li&gt;
&lt;li&gt;&lt;a href="
http://jeromyanglim.blogspot.com/2010/03/export-from-endnote-to-bibtex-jabref.html
"&gt;Bibtex, Jabref&lt;/a&gt;, and other tools replaced Endnote as a bibliographic reference
management system.&lt;/li&gt;
&lt;li&gt;&lt;a href="
http://jeromyanglim.blogspot.com/2011/01/reasons-for-transitioning-to-vim.html"&gt;Vim replaced a host of other IDEs&lt;/a&gt;, 
and text editors; it even replaced MS Word, in that it became the editor for
the plain text file formats (e.g., LaTeX, Sweave, Markdown, etc.) that I use the
most.&lt;/li&gt;
&lt;li&gt;&lt;a href="
http://jeromyanglim.blogspot.com/2010/11/getting-started-with-git-egit-eclipse.html
"&gt;git&lt;/a&gt; replaced ad hoc version control systems.&lt;/li&gt;
&lt;li&gt;&lt;a href="
http://jeromyanglim.blogspot.com/2010/11/makefiles-for-sweave-r-and-latex-using.html
"&gt;&lt;code&gt;make&lt;/code&gt;&lt;/a&gt;
replaced various manual processes for building final products.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For a general summary of this workflow (albeit, prior to the adoption of Vim),
&lt;a href="
http://jeromyanglim.blogspot.com/2010/12/video-of-reproducible-research-with-r.html
"&gt;see this video that I gave at Melbourne R Users in late 2010&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;However, I still needed to cut ties from Windows, the operating system I'd been
using for 15 years.
I'd been putting off adopting Linux for several reasons.
I was concerned about:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;hardware support for my main computer,&lt;/li&gt;
&lt;li&gt;the temporary drop in performance that results from adopting a new operating
system,&lt;/li&gt;
&lt;li&gt;difficulties collaborating with other researchers operating in the Windows
world,&lt;/li&gt;
&lt;li&gt;lack of support for various key programs (e.g., Outlook; Inquisit), and&lt;/li&gt;
&lt;li&gt;the possibility that some tasks would be less efficient under Linux.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Despite these concerns, I decided to finally dive in.&lt;/p&gt;

&lt;h3&gt;Initial foray into Cygwin&lt;/h3&gt;

&lt;p&gt;About a month prior to making the switch I'd installed
&lt;a href="http://www.cygwin.com/"&gt;Cygwin&lt;/a&gt; on Windows.
This gave me access to many Linux command-line programs.
However, ultimately, while Cygwin whet my appetite, it failed to satisfy.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;By default, Cygwin does not always play nicely with non-Cygwin programs.
File paths often get confused.
If it can't play nicely with Windows programs, I might as well go all the way.&lt;/li&gt;
&lt;li&gt;There are issues of where to store files (Cygwin home or Windows user home).&lt;/li&gt;
&lt;li&gt;Some Linux programs are not included.&lt;/li&gt;
&lt;li&gt;The speed of the terminal and shell was often poor.&lt;/li&gt;
&lt;li&gt;In general, interacting with other programs was a frustrating experience.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;While some of these challenges probably could have been overcome, it felt silly
investing time in learning the idiosyncrasies of a system that only goes
half-way to creating a genuine unix experience.&lt;/p&gt;

&lt;h3&gt;Choosing a Linux distribution&lt;/h3&gt;

&lt;p&gt;The first decision involved choosing a Linux distribution.
I decided on Ubuntu for several reasons.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It's a popular Linux distribution.&lt;/li&gt;
&lt;li&gt;It seems like a good distribution for people new to Linux.&lt;/li&gt;
&lt;li&gt;Hardware support looked encouraging.&lt;/li&gt;
&lt;li&gt;I'd heard it was well suited as a personal desktop&lt;/li&gt;
&lt;li&gt;I'd also heard that ultimately Linux is configurable and thus, the
distribution does not provide major constraints; furthermore basic unix
command-line programs should work in all distributions.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Preparing to install Ubuntu&lt;/h3&gt;

&lt;p&gt;I approached the installation of Ubuntu with trepidation.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I read a lot about partitioning and dual-booting on &lt;a href="
https://help.ubuntu.com/community/HowtoPartition"&gt;Ubuntu documentation&lt;/a&gt; and &lt;a href="
http://www.psychocats.net/ubuntu/partitioning"&gt;psychocats&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;I backed up my data (of course) before starting installation.&lt;/li&gt;
&lt;li&gt;I thought a lot about setting up my partitions. 
In the end I decided on a dual-boot partition.
I have a solid state drive which is really fast, but capacity is not that high
(only 120gb).
Thus, I had to be careful with assigning space.
I gave 40gb to Windows and 80gb to Ubuntu.
This required the removal of many unwanted files from the Windows partition.&lt;/li&gt;
&lt;li&gt;I created and trialled the Ubuntu Live USB to check for hardware support, and
everything seemed to be working surprisingly well on my Dell Latitude laptop.&lt;/li&gt;
&lt;li&gt;I then installed Ubuntu, letting the Ubuntu installer handle the hard drive
partitioning.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To my pleasant surprise, the installation was smooth, involving minimal choices.
The Ubuntu installation successfully partitioned my hard drive, and the core
features of my laptop still worked (sleep, hibernate, wifi, volume buttons,
graphics card, and so on).
Furthermore, I was still able to boot into Windows for when I really needed to
use Windows-only software.&lt;/p&gt;

&lt;h3&gt;Reflection on the installation&lt;/h3&gt;

&lt;p&gt;Switching operating systems is painful even when the new operating system
is better than the old one.
Many little tasks that were once automatic need to be automated in a new way.
Furthermore, to fully grok the new system, it is often necessary to do more than
map the old workflow onto the new system.&lt;/p&gt;

&lt;p&gt;For the most part the switch to Ubuntu has been smoother than I was expecting.
The first week involved dealing with a wide range of fundamental issues related
to software installation and system configuration.
However, in general, these issues have been resolved by a few Internet searches
and asking questions on &lt;a href="http://askubuntu.com/"&gt;Ask Ubuntu&lt;/a&gt; (a Stack
Exchange Q+A site).&lt;/p&gt;

&lt;p&gt;The following were some of the main issues I encountered:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Linking with my university email / calendar Exchange server has been painful.
After two weeks, this still remains my biggest pain; The email program
Evolution basically works, but is painfully slow at times, often freezes, and
often produces errors.&lt;/li&gt;
&lt;li&gt;Configuring the Unity desktop (the default behaviour of the 11.04 launcher
is awful) took a bit of searching.&lt;/li&gt;
&lt;li&gt;Configuring so that I could move between laptop monitor configurations
required some fiddling.&lt;/li&gt;
&lt;li&gt;Configuring my &lt;code&gt;vimrc&lt;/code&gt; took some work. I had a number of file format issues
related to text files having inappropriate line feeds (i.e., Windows text
files instead of Unix text files).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Despite these issues I'm really enjoying using Ubuntu.
Adopting a Vim + command-line workflow is so much easier, and I'm gradually
incorporating some of the great Linux tools into my workflow.&lt;/p&gt;

&lt;h3&gt;Some reading&lt;/h3&gt;

&lt;p&gt;As part of the transition, I've also been reading a few books:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Harley Hahn's guide to Unix and Linux - Harley Hahn
&lt;ul&gt;
&lt;li&gt;This one was quite pedagogical in flavour and a bit wordy at times, but
did provide a helpful introduction to Linux.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;UNIX power tools - Jerry Peek, Tim O'Reilly, Mike Loukide
&lt;ul&gt;
&lt;li&gt;This book is massive. &lt;/li&gt;
&lt;li&gt;It provides heaps of short articles outlining useful tricks for getting
more out of Unix / Linux.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;Learning the bash Shell - Cameron Newham, Bill Rosenblatt&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Looking forward&lt;/h3&gt;

&lt;p&gt;As I get settled into the new operating system I'm looking forward to 
really incorporating the tools available into my research workflow.&lt;/p&gt;

&lt;p&gt;Some of the things I'm looking forward to (which I may blog about at some point,
&lt;a href="
http://feeds.feedburner.com/jeromyanglim"&gt;see here for Blog RSS subscription options&lt;/a&gt;)
include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Writing some bash scripts and Vim commands to enable me to link bibtex
citations to stored pdfs of journal articles;&lt;/li&gt;
&lt;li&gt;Taking advantage of the command-line for file manipulation, running R,
creating LaTeX documents, and more; and&lt;/li&gt;
&lt;li&gt;Dabbling in sed, awk, Python for better text manipulation.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now with the first two weeks of initial adjustment out of the way, the subtler
phase of tweaking and refinement begins.
If you've made the switch to Linux particularly within the context of research
and data analysis, I'd be keen to hear your experience.&lt;/p&gt;

&lt;h3&gt;Assorted Resolved Issues&lt;/h3&gt;

&lt;h4&gt;Overview&lt;/h4&gt;

&lt;p&gt;The rest of this post documents a wide range of problems that I encountered when
getting started with Ubuntu and the solutions that I adopted.
The caveat applies that I'm pretty new to Ubuntu, so the solutions may not
be best practice.
Furthermore, they may not make for interesting reading unless perhaps you've
stumbled onto this post through Google searching for the specific problem.&lt;/p&gt;

&lt;h4&gt;Overhaul file system&lt;/h4&gt;

&lt;h5&gt;Question&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;What are the implications of Linux for how my file system should be organised?&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;Discussion&lt;/h5&gt;

&lt;p&gt;I used the transition to Linux to overhaul my file system.
I was keen to use the terminal to access files.
Good file names for terminal access are different to that for a point-and-click
environment.&lt;/p&gt;

&lt;p&gt;Some general principles that guided the new file system&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Remove spaces from file names 
&lt;ul&gt;
&lt;li&gt;It's a pain to have to escape spaces (&lt;code&gt;\&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;I replaced spaces with hyphen "-"&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;Convert file names to lower case where possible
&lt;ul&gt;
&lt;li&gt;Linux is case sensitive&lt;/li&gt;
&lt;li&gt;It's quicker to type lower case&lt;/li&gt;
&lt;li&gt;Consistency reduces confusion&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;Prefer file and folder names unique in the first few letters
&lt;ul&gt;
&lt;li&gt;This facilitates tab completion&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;Prefer short, descriptive, and memorable file names&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I also found it particularly useful to do a general reflection on my file
structure.
I cleaned up the hierarchy so that all my core activities had a location in the
file system.&lt;/p&gt;

&lt;h4&gt;Accessing Windows Drive from Ubuntu&lt;/h4&gt;

&lt;h5&gt;Question&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;Are there any issues with accessing the Windows OS partition from Ubuntu?&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;Discussion&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;It's easy.
It shows up as a mounted drive called "OS".
It's path was &lt;code&gt;/media/OS&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Monitoring processes and use of system resources&lt;/h4&gt;

&lt;h5&gt;Question&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;What is the Ubuntu equivalent of &lt;code&gt;Ctrl+Alt+Delete&lt;/code&gt; for viewing active
processes and memory and processor usage?&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;Discussion&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;There is a program called "System Monitor"&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Command prompt for terminal colour&lt;/h4&gt;

&lt;h5&gt;Question&lt;/h5&gt;

&lt;p&gt;It seems to me that it might be useful to make the command prompt a different
colour to help make it clear where one command starts and output begins a little
clearer.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How can this be done?&lt;/li&gt;
&lt;li&gt;What are good colour options?&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;Discussion&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;Sites discussing the issue
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.cyberciti.biz/faq/bash-shell-change-the-color-of-my-shell-prompt-under-linux-or-unix/"&gt;cyberciti&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://wiki.archlinux.org/index.php/Color_Bash_Prompt"&gt;archlinux wiki&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;.bashrc&lt;/code&gt; file that came with Ubuntu had a setting that could be enabled to
have a colour prompt.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Opening common binary files from command-line&lt;/h4&gt;

&lt;h5&gt;Question&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;How can common binary files (e.g., PDF, Word, Excel, PowerPoint) be opened
from the command line?&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;Discussion&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;gnome-open&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;This command can be followed by filenames, web addresses, directories, and
will typically do some appropriate default action.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;gnome-open .&lt;/code&gt; opens the current directory in Nautilus&lt;/li&gt;
&lt;li&gt;&lt;code&gt;alias go=’gnome-open’&lt;/code&gt; or equivalent may be useful&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Keyboard shortcuts for size window left or right half of screen&lt;/h4&gt;

&lt;h5&gt;Question&lt;/h5&gt;

&lt;p&gt;I tend to work on a large monitor with space for Windows on the left and right
side of the screen.
I like to have a keyboard shortcut which sizes a window to the left or right of
the screen.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How can this be done on Ubuntu?&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;Discussion&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;Ubuntu does support half Desktop sizing by dragging a window with the mouse to
the left or right most side of the desktop.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;keyboard shortcuts&lt;/code&gt; offers some options for moving windows, including
maximise vertically or maximise horizontally, but no option for positioning
window on left half of screen.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;Ctrl+Alt+NumPad Key&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I learnt the &lt;a href="
http://askubuntu.com/questions/39740/is-there-a-unity-compiz-shortcut-key-to-move-a-window-to-your-other-monitor-no"&gt;following on
askubuntu&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;By default Ubuntu supports shortcut keys for window manipulation (e.g.,
&lt;code&gt;Ctrl+Alt+NumPad4&lt;/code&gt; maximises a window vertically on the left half of the
screen and &lt;code&gt;Ctrl+Alt+NumPad6&lt;/code&gt; does the same but to the right.&lt;/li&gt;
&lt;li&gt;The main annoying aspect of this is that these keys are not suitable for
touch typing.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Solution&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Install Advanced Desktop Effects settings (Compiz with Compiz Config)&lt;/li&gt;
&lt;li&gt;Start CompizConfig&lt;/li&gt;
&lt;li&gt;Go to Window Manager - Grid&lt;/li&gt;
&lt;li&gt;Change the key bindings (I chose the following, which have a certain
consistency with Vim movement keys)
&lt;ul&gt;
&lt;li&gt;Super + h (left)&lt;/li&gt;
&lt;li&gt;Super + L (right)&lt;/li&gt;
&lt;li&gt;Super + K (maximise)&lt;/li&gt;
&lt;li&gt;Super + J (restore)&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Shortcut key to initiate web search&lt;/h4&gt;

&lt;h5&gt;Question&lt;/h5&gt;

&lt;p&gt;On windows I had a global shortcut key (Windows+Z) to initiate a Google search.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How can this be done on Ubuntu?&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;Discussion&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;googlizer&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;This can be used to create command line programs for searching.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;Chrome
&lt;ul&gt;
&lt;li&gt;Start chrome&lt;/li&gt;
&lt;li&gt;Type search term in address bar&lt;/li&gt;
&lt;li&gt;Making &lt;code&gt;google.com&lt;/code&gt; the home page can speed this up&lt;/li&gt;
&lt;li&gt;Evaluation: 
&lt;ul&gt;
&lt;li&gt;The responsiveness of this is not adequate (a search box is instant;
chrome takes around 1 second to start up)&lt;/li&gt;
&lt;li&gt;It results in the loss of the default Chrome homepage&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;AutoKey
&lt;ul&gt;
&lt;li&gt;A program modelled on AutoHotKey might provide the desired functionality.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;I asked the &lt;a href="
http://askubuntu.com/questions/42398/shortcut-key-to-simple-textbox-to-perform-google-search
"&gt;question on askubuntu&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;Google Desktop Search with Desktop search disabled was a good choice.&lt;/li&gt;
&lt;li&gt;I changed the default shortcut key to &lt;code&gt;Ctrl+F12&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Using a laptop with multiple external monitors&lt;/h4&gt;

&lt;h5&gt;Question&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;How can a laptop monitor be disabled and an external monitor enabled?&lt;/li&gt;
&lt;li&gt;I use two external monitors, one at home, and one at work.
How can Ubuntu be configured to automatically detect which one is connected?&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;Discussion&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;When I configure to just use my external monitor and not my laptop monitor and
then unplug the external monitor, the laptop monitor is not activated.
Thus, I can't use the mouse to reactivate the laptop monitor.
It would be good if Ubuntu could automatically detect the removal of the
external monitor, or alternatively I could have a shortcut key to activate
laptop only mode.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="http://www.ubuntugeek.com/enable-ctrl-alt-backspace-in-ubuntukubuntu-10-04lucid-lynx.html"&gt;ubuntugeek&lt;/a&gt;
describes configuring Ubuntu so that &lt;code&gt;Ctrl+Alt+Backspace&lt;/code&gt; can force a restart
of X&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A user asks about automatic switching of monitor configurations on &lt;a href="
http://ubuntuforums.org/showthread.php?t=1712863"&gt;Ubuntu
forums&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="http://ubuntuforums.org/showthread.php?t=1074137"&gt;More suggestions&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;I asked the question on
&lt;a href=""http://askubuntu.com/questions/42390/one-click-shutdown-ubuntu-and-load-into-alternative-bootup"&gt;askubuntu&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I added my answer to the question&lt;/li&gt;
&lt;li&gt;Essentially it involves using a program called &lt;code&gt;disper&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;disper -s&lt;/code&gt; and &lt;code&gt;disper -S&lt;/code&gt; activate primary and secondary monitors
respectively. 
I've configured these commands to be triggered by shortcut keys using
CompizConfig.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Launching programs with keyboard shortcuts&lt;/h4&gt;

&lt;h5&gt;Question&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;What is a good strategy for launching programs from keyboard shortcuts?&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;Discussion&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;CompizConfig makes it easy to create commands and assign shortcut keys.&lt;/li&gt;
&lt;li&gt;The Unity Launcher enables shortcut keys combining the Super key and a number
or typing the Super key and typing a key word.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Restart to Windows&lt;/h4&gt;

&lt;h5&gt;Question&lt;/h5&gt;

&lt;p&gt;My bootloader defaults to Ubuntu.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Is there a way to shutdown Ubuntu and boot to Windows without having to make a
selection from the bootloader?&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;Discussion&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;I asked &lt;a href="
http://askubuntu.com/questions/42390/one-click-shutdown-ubuntu-and-load-into-alternative-bootup"&gt;the question on Ask Ubuntu&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;I received a good answer, and I added further details on AskUbuntu.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Default terminal size&lt;/h4&gt;

&lt;h5&gt;Question&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;What is a good default Terminal size?&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;Discussion&lt;/h5&gt;

&lt;p&gt;I can always press F11 to get a full-screen terminal.
However, sometimes it is useful to be able to have a reasonable size terminal
come up that does not take over the whole screen.&lt;/p&gt;

&lt;p&gt;I've configured the default profile to be 95 columns by 40 rows.
I would choose more rows, but I want the setup to work on my smallest monitor
(i.e., my laptop).&lt;/p&gt;

&lt;h4&gt;Prevent Unity menu from showing&lt;/h4&gt;

&lt;h5&gt;Question&lt;/h5&gt;

&lt;p&gt;At first I thought the Unity menu was okay.
However, I don't like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the screen real estate that launcher consumes&lt;/li&gt;
&lt;li&gt;the way that it defaults to placing left aligned windows indented with space
to the launcher&lt;/li&gt;
&lt;li&gt;The size of the launcher icons (although at least this can be reduced)&lt;/li&gt;
&lt;li&gt;The way that it stays in focus sometimes for a period of time &lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;Discussion&lt;/h5&gt;

&lt;p&gt;I asked &lt;a href="
http://askubuntu.com/questions/42473/how-to-make-unity-launcher-menu-be-almost-always-hidden-and-not-influence-window"&gt;the question on askubuntu&lt;/a&gt; and received a good suggestion.&lt;/p&gt;

&lt;p&gt;In Compix Config set Unity - Hide Launcher to Auto-hide.&lt;/p&gt;

&lt;h4&gt;Configuring Ubuntu for running basic scripts&lt;/h4&gt;

&lt;h5&gt;Question&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;What is a basic strategy for running scripts in Ubuntu?&lt;/li&gt;
&lt;li&gt;How do permanently add the custom script to the path?&lt;/li&gt;
&lt;li&gt;Where should I store throw-away scripts?&lt;/li&gt;
&lt;li&gt;What is a good way to run custom scripts?&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;Discussion&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;There is a &lt;a href="http://ubuntuforums.org/showthread.php?t=654612"&gt;discussion of where to store scripts here&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;A common place seems to be &lt;code&gt;~/bin&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I did the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;mkdir ~/bin&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;added &lt;code&gt;export PATH="$PATH:~/bin"&lt;/code&gt; to &lt;code&gt;.bashrc&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Find file by name&lt;/h4&gt;

&lt;h5&gt;Question&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;How can I find a file by a name or part of its name within a specified
directory (or subdirectories)?&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;Discussion&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Cyberciti provides &lt;a href="
http://www.cyberciti.biz/tips/linux-findinglocating-files-with-find-command-part-1.html"&gt;a page explaining several options&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;find&lt;/code&gt; command&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The following command would find all files with the &lt;code&gt;txt&lt;/code&gt; extension in &lt;code&gt;~/dir&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;find ~/dir -name "*.txt"&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Accessing Ubuntu drive from Windows on dual-boot machine&lt;/h4&gt;

&lt;h5&gt;Question&lt;/h5&gt;

&lt;p&gt;I store my data on my Ubuntu drive.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How can I access my Ubuntu drive from Windows?&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;Discussion&lt;/h5&gt;

&lt;p&gt;This &lt;a href="
http://www.psychocats.net/ubuntu/partitioning"&gt;page has three options&lt;/a&gt;, the last of which, looks like
what I want.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ext2 Installable File System for Windows
&lt;ul&gt;
&lt;li&gt;This did not work on Windows 7 (perhaps this will change in the future)&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;DiskInternals Linux Reader
&lt;ul&gt;
&lt;li&gt;Evaluation
&lt;ul&gt;
&lt;li&gt;This worked adequately&lt;/li&gt;
&lt;li&gt;This has both the benefit and the problem that it does not alter the
Linux partition&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;How did it work?
&lt;ul&gt;
&lt;li&gt;Start Windows 7&lt;/li&gt;
&lt;li&gt;Install and Start DiskInternals&lt;/li&gt;
&lt;li&gt;Save selected Linux partition files onto Windows partition (I had a
special section)&lt;/li&gt;
&lt;li&gt;View, edit, and change files&lt;/li&gt;
&lt;li&gt;Restart Ubuntu and copy files from Windows partition back into
appropriate location &lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Script fur renaming files in folder&lt;/h4&gt;

&lt;h5&gt;Question&lt;/h5&gt;

&lt;p&gt;I sometimes download files sent to me and want to convert the file names into
more appropriate ones.&lt;/p&gt;

&lt;p&gt;The main conversions that I'd like to see are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;replace spaces with dashes ("-")&lt;/li&gt;
&lt;li&gt;replace uppercase with lower case&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Others may arise as time goes by.&lt;/p&gt;

&lt;p&gt;The script should take a list of file names.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How can this be done?&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;Discussion&lt;/h5&gt;

&lt;p&gt;I wrote the following script and called it &lt;code&gt;cleannames&lt;/code&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;#!/bin/bash
for file in * ; do mv "$file" `echo "$file" | sed 's/ /-/g'`; done
for file in * ; do mv "$file" `echo "$file" | sed 's/.*/\L&amp;amp;/g'`; done
&lt;/code&gt;&lt;/pre&gt;

&lt;h4&gt;Minimise current window with keyboard shortcut&lt;/h4&gt;

&lt;h5&gt;Question&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;What is the keyboard shortcut to minimise a Window?&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;Discussion&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;Alt+F9 minimises&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Alt+F10 maximise&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Launcher - System Settings - Shortcuts allows for custom shortcut keys&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Terminator Terminal&lt;/h4&gt;

&lt;h5&gt;Question&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;Should I adopt Terminator Terminal?&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;Discussion&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;At present I'm using Gnome Terminal.&lt;/li&gt;
&lt;li&gt;Various reviews suggest that Gnome terminal is a reasonable option in terms of
speed and features.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Preventing automatic shading when watching flash videos&lt;/h4&gt;

&lt;h5&gt;Question&lt;/h5&gt;

&lt;p&gt;I had an ABC video on full screen and after a few minutes, Ubuntu shaded the
screen.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How can this be prevented?&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;Discussion&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Power Management&lt;/code&gt; has some options&lt;/li&gt;
&lt;li&gt;I disabled the screensaver. That seemed to fix the problem.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Batch renaming of files&lt;/h4&gt;

&lt;h5&gt;Question&lt;/h5&gt;

&lt;p&gt;Unix is case sensitive.
It also encourages substantially greater use of the command-line.
As such, it is useful to adopt file naming conventions that make it easier to
work with files on the command-line.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How can I batch rename files
&lt;ul&gt;
&lt;li&gt;replace underscore with dash&lt;/li&gt;
&lt;li&gt;replace upper case letter with corresponding lower case letter&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;Discussion&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;Some options
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;KRename&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;for&lt;/code&gt; loop
&lt;ul&gt;
&lt;li&gt;&lt;a href="
http://lab.artlung.com/unix-batch-file-rename/"&gt;Tutorial on using for loops&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;rename&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Convert underscore to dash:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;`for file in * ; do mv $file `echo $file | sed 's/_//'` ; done`
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Convert upper case letter
&lt;a href="http://www.ubuntu4life.com/lowercase_files_and_directories"&gt;This tutorial shows&lt;/a&gt;
how to use the convmv command.&lt;/p&gt;

&lt;h4&gt;Kill a program&lt;/h4&gt;

&lt;h5&gt;Question&lt;/h5&gt;

&lt;p&gt;Windows has Ctrl+Alt+Delete which facilitates killing a process.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What does Ubuntu involve?&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;Discussion&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;The system monitor lists processes and enables killing processes&lt;/li&gt;
&lt;li&gt;Ctrl+Alt+Backspace kills X (once this feature is activated)&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Better console / terminal colours&lt;/h4&gt;

&lt;h5&gt;Question&lt;/h5&gt;

&lt;p&gt;The default background for Ubuntu terminal is a type of dark purple.
While it's "pretty", I find the contrast to be relatively low.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What are better settings?&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;Discussion&lt;/h5&gt;

&lt;p&gt;I applied the following settings:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Edit - Preferences: 
&lt;ul&gt;
&lt;li&gt;Colors - Built-in schemes= white on black&lt;/li&gt;
&lt;li&gt;Background = solid colour&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;export TERM="xterm-256color"&lt;/code&gt; enables better colour support for Vim&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Problems displaying full screen video&lt;/h4&gt;

&lt;h5&gt;Question&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;I find that full screen video on YouTube seems to freeze.
How can this be fixed?&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;Discussion&lt;/h5&gt;

&lt;p&gt;There is a &lt;a href="
http://www.youtube.com/watch?v=SeO8YytqEKE"&gt;tutorial on YouTube&lt;/a&gt; on how to fix this.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo mkdir /etc/adobe
sudo su
sudo echo "OverrideGPUValidation = 1" &amp;gt;&amp;gt; /etc/adobe/mms.cfg"
&lt;/code&gt;&lt;/pre&gt;

&lt;h4&gt;Reducing Grub loader times&lt;/h4&gt;

&lt;h5&gt;Question&lt;/h5&gt;

&lt;p&gt;I think it would be useful to reduce the default grub display time to something
like 1 or 2 seconds.
I almost always boot to Ubuntu, and if I want to boot to Windows, I have a
command from within Ubuntu that changes the default boot for one occasion.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Is this a good idea?&lt;/li&gt;
&lt;li&gt;How can I do this?&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;Discussion&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;I think 2 seconds would make sense as this is long enough to easily enter
manual mode if I am watching carefully.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;sudo vim/etc/default/grub&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;I modified the value of &lt;code&gt;GRUB_TIMEOUT&lt;/code&gt; and made it &lt;code&gt;GRUB_TIMEOUT=2&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;sudo update-grub&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Set up git on Ubuntu&lt;/h4&gt;

&lt;h5&gt;Question&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;How do I configure git on Ubuntu?&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;Discussion&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;General information on configuring git and github on Linux is &lt;a href="http://help.github.com/linux-set-up-git/"&gt;available
here&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=AaLnhZaxf4k:7a7DgIHgSBE:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=AaLnhZaxf4k:7a7DgIHgSBE:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=AaLnhZaxf4k:7a7DgIHgSBE:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=AaLnhZaxf4k:7a7DgIHgSBE:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=AaLnhZaxf4k:7a7DgIHgSBE:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=AaLnhZaxf4k:7a7DgIHgSBE:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=AaLnhZaxf4k:7a7DgIHgSBE:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=AaLnhZaxf4k:7a7DgIHgSBE:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=AaLnhZaxf4k:7a7DgIHgSBE:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/jeromyanglim/~4/AaLnhZaxf4k" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://jeromyanglim.blogspot.com/feeds/6254402501596748604/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://jeromyanglim.blogspot.com/2011/05/transition-to-linux-and-ubuntu.html#comment-form" title="12 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8909074830238091680/posts/default/6254402501596748604?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8909074830238091680/posts/default/6254402501596748604?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/jeromyanglim/~3/AaLnhZaxf4k/transition-to-linux-and-ubuntu.html" title="Transition to Linux and Ubuntu: The Experience of a Quantitative Social Scientist" /><author><name>Jeromy Anglim</name><uri>https://plus.google.com/100803004599943057656</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-xUmT1aa-RI0/AAAAAAAAAAI/AAAAAAAAAvk/eN47FjC3uVU/s512-c/photo.jpg" /></author><thr:total>12</thr:total><feedburner:origLink>http://jeromyanglim.blogspot.com/2011/05/transition-to-linux-and-ubuntu.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0QESXg9cSp7ImA9WhZXFU8.&quot;"><id>tag:blogger.com,1999:blog-8909074830238091680.post-2237580919241449465</id><published>2011-05-04T16:46:00.001+10:00</published><updated>2011-05-05T01:01:48.669+10:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-05-05T01:01:48.669+10:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="R" /><title>Guide to Getting Started with R: 2011 Update</title><content type="html">&lt;p&gt;In mid-2009, I wrote a post on getting started with R. 
A lot has happened in the world of R over the last two years. 
New books, videos, online documentation, blogs and other resources have emerged. 
New community structures have emerged. 
As such I've given the guide a major overhaul both to increase its usability 
and acknowledge the many exciting changes in the world of R.  &lt;a href="
 http://jeromyanglim.blogspot.com/2009/06/learning-r-for-researchers-in.html
"&gt;The 
updated Guide to Getting Started with R is available here.&lt;/a&gt;.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=9ErBbpi-yN0:JJnOOlywrbc:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=9ErBbpi-yN0:JJnOOlywrbc:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=9ErBbpi-yN0:JJnOOlywrbc:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=9ErBbpi-yN0:JJnOOlywrbc:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=9ErBbpi-yN0:JJnOOlywrbc:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=9ErBbpi-yN0:JJnOOlywrbc:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=9ErBbpi-yN0:JJnOOlywrbc:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=9ErBbpi-yN0:JJnOOlywrbc:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=9ErBbpi-yN0:JJnOOlywrbc:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/jeromyanglim/~4/9ErBbpi-yN0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://jeromyanglim.blogspot.com/feeds/2237580919241449465/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://jeromyanglim.blogspot.com/2011/05/guide-to-getting-started-with-r-2011.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8909074830238091680/posts/default/2237580919241449465?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8909074830238091680/posts/default/2237580919241449465?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/jeromyanglim/~3/9ErBbpi-yN0/guide-to-getting-started-with-r-2011.html" title="Guide to Getting Started with R: 2011 Update" /><author><name>Jeromy Anglim</name><uri>https://plus.google.com/100803004599943057656</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-xUmT1aa-RI0/AAAAAAAAAAI/AAAAAAAAAvk/eN47FjC3uVU/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://jeromyanglim.blogspot.com/2011/05/guide-to-getting-started-with-r-2011.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEMFR349eSp7ImA9WhZQF0w.&quot;"><id>tag:blogger.com,1999:blog-8909074830238091680.post-6319574097972116689</id><published>2011-04-25T17:26:00.000+10:00</published><updated>2011-04-25T17:26:56.061+10:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-04-25T17:26:56.061+10:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="vim" /><category scheme="http://www.blogger.com/atom/ns#" term="Inquisit" /><title>Case Study in Customising Syntax Highlighting and Folding in Vim for a Niche Scripting Language Called Inquisit</title><content type="html">&lt;p&gt;This post presents my efforts to setup a productive environment for editing
Inquisit scripts in Vim.
In addition to being relevant to people who write Inquisit scripts, the post
is designed as a general case study in customising Vim for a niche
programming language.
Specifically, the post discusses how to setup in Vim:
(a) code folding using a custom expression,
(b) custom syntax highlighting, and
(c) interactions with the command-line.
&lt;a name='more'&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;Overview&lt;/h3&gt;

&lt;p&gt;Inquisit is proprietary software typically used for running computerised
experiments in the behavioural sciences.
The &lt;a href="http://www.millisecond.com/"&gt;Inquisit Website&lt;/a&gt; has further explanation
and includes a free limited trial.
I have previously discussed the benefits of the software for &lt;a href="
http://jeromyanglim.blogspot.com/2009/10/practical-tips-on-how-to-conduct_05.html"&gt;running online
psychological experiments&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Inquisit includes desktop software that runs on Windows.
It can be used to write, debug, and run Inquisit scripts that control the
flow of the experiment.
I have provided a simple example of a script here as a &lt;a href="
https://gist.github.com/938629"&gt;gist on github&lt;/a&gt;.
It contains a simple RT task, four choice RT task, and a typing test.
Further example scripts can be seen in the &lt;a href="http://www.millisecond.com/download/samples/"&gt;Task Library on the Inquisit
Website&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;More recently I have started using Vim to do my text editing (see &lt;a href="
http://jeromyanglim.blogspot.com/2011/01/reasons-for-transitioning-to-vim.html"&gt;my
previous post on this conversion&lt;/a&gt;.
The conversion was motivated by an aim to increase the power and consistency
of my text editing environment. 
Thus, instead of using a separate text editor for each programming language
that I code in, I wanted, as much as possible to be able to use Vim
for as many tasks as possible.&lt;/p&gt;

&lt;p&gt;Vim has great built-in support for many languages, however, Inquisit is a
niche scripting language.
Thus, Vim lacked built-in support for the language.
Nonetheless, to true power of Vim is its customisability.&lt;/p&gt;

&lt;p&gt;Below I explain the customisations I developed to work more effectively with
Inquisit.
It is still a work in progress, and imperfect. 
However, even at this stage, I find writing Inquisit scripts far more
enjoyable than using the editor built-in to the Inquisit software.&lt;/p&gt;

&lt;p&gt;I present this example as a case study in customising Vim for a new
programming language.&lt;/p&gt;

&lt;p&gt;If you want to follow any updates, check out:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the git repository with the entire contents of my &lt;a href="
https://github.com/jeromyanglim/JA_Vimfiles"&gt;vimfiles and plugins&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;inside the repository is my &lt;a href="
https://github.com/jeromyanglim/JA_Vimfiles/blob/master/myvimrc"&gt;vimrc&lt;/a&gt;
which includes various customisations for Inquisit file types.&lt;/li&gt;
&lt;li&gt;my syntax highlighting file for &lt;a href="
https://github.com/jeromyanglim/JA_Vimfiles/blob/master/syntax/inquisit.vim"&gt;Inquisit files&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Below I describe a few of these customisations.
The sections of greatest general interest are likely to be those on syntax
highlighting and code folding.&lt;/p&gt;

&lt;h3&gt;Overview of an Inquisit script&lt;/h3&gt;

&lt;p&gt;Before describing my customisations, below is a short snippet from an
Inquisit script:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;# general stimuli
&amp;lt;text cross&amp;gt;
/position=(50%, 50%)
/items=("+")
/fontstyle = ("Arial", 60pt, false)
&amp;lt;/text&amp;gt;

&amp;lt;text error.toosoon&amp;gt;
/position=(50%, 50%)
/items=("PRESSED TOO SOON")
/fontstyle = ("Arial", 30pt, false)
/txcolor =(255,0,0)
&amp;lt;/text&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;ul&gt;
&lt;li&gt;The line beginning with a hash is my own internal section marker.
All text outside element tags &lt;code&gt;&amp;lt;...&amp;gt;...&amp;lt;/...&amp;gt;&lt;/code&gt; is not interpreted by
Inquisit.&lt;/li&gt;
&lt;li&gt;The code is made up of elements which have a keyword name (e.g., &lt;code&gt;text&lt;/code&gt;)
and an identifier (e.g., &lt;code&gt;cross&lt;/code&gt; or &lt;code&gt;error.toosoon&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;In the above example, these elements are used to represent objects
displayed on a screen such as a plus symbol or some text.&lt;/li&gt;
&lt;li&gt;Elements have attributes, which have a name and a value.
Attributes are contained between opening (e.g., &lt;code&gt;&amp;lt;text ...&amp;gt;&lt;/code&gt;) and closing
element tags (e.g., &lt;code&gt;&amp;lt;/text&amp;gt;&lt;/code&gt;).
Attributes begin with a slash, then the name of the attribute (e.g.,
&lt;code&gt;position&lt;/code&gt;, then equals sign, and then the value of the attribute.&lt;/li&gt;
&lt;li&gt;Values of attributes have various syntactical forms typically involving
either parentheses or square brackets.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;My scripts often range between 500 and 2000 lines of code.
For a more complete example, see the &lt;a href="
https://gist.github.com/938629"&gt;gist mentioned earlier&lt;/a&gt;.
You can even download a free trial of the software if you'd like to see how
it runs.
The remainder of this post describes the customisations that I developed to
make writing Inquisit scripts in Vim more productive.&lt;/p&gt;

&lt;h3&gt;Launching an Inquisit Script from Vim&lt;/h3&gt;

&lt;h4&gt;Question&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;How can Inquisit Scripts be tested directly from Vim command-line?&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Discussion&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="
http://www.millisecond.com/support/docs/v3/html/howto/howtocommandline.htm"&gt;Inquisit Help lists command line options&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I adopted the following strategy.
First, I added the Inquisit executable to the path; E.g., I added 
&lt;code&gt;C:\Program Files\Millisecond Software\Inquisit 3&lt;/code&gt; to my path.
This means that entering &lt;code&gt;inquisit&lt;/code&gt; on the command-line starts Inquisit.&lt;/p&gt;

&lt;p&gt;Then I added the following code to my &lt;code&gt;vimrc&lt;/code&gt; file.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;function! RunInquisit()
    let cmdstring = "!start inquisit " . '"%:p"'
    exe cmdstring
endfunction
&lt;/code&gt;&lt;/pre&gt;

&lt;ul&gt;
&lt;li&gt;Thus, when I have an Inquisit script open in Vim, I just have to type
&lt;code&gt;:call RunInquisit()&lt;/code&gt; and this will start Inquisit and send the script in
the active buffer to Inquisit for running. 
Once run, this enables debugging of any errors (Inquisit has a good
built-in debugger). 
If no errors are obtained, the experiment will start, which facilitates
the identification of errors in the actual design of the experiment.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;function!&lt;/code&gt; declares a new function overriding any previous function by
the same name.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;RunInquisit()&lt;/code&gt; is the arbitrary name of the function, although it does
need to start with a capital letter. In this case, it takes no arguments.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;let cmdstring...&lt;/code&gt; assigns a string to the variable &lt;code&gt;cmdstring&lt;/code&gt;.
The period (&lt;code&gt;.&lt;/code&gt;) is the concatenation operator.
&lt;code&gt;!start&lt;/code&gt; is means of starting a program from the command line asynchronously.
&lt;code&gt;inquisit&lt;/code&gt; is the name of the Inquisit executable.
&lt;code&gt;%:p&lt;/code&gt; is a file modifier pattern where &lt;code&gt;%&lt;/code&gt; represents the active buffer
and &lt;code&gt;:p&lt;/code&gt; indicates that the pattern should be replaced with the file name
with complete path for the active buffer. See &lt;code&gt;:h filename-mod&lt;/code&gt; for more
information.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;exe&lt;/code&gt; executes the string on the Vim command-line.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Code Folding&lt;/h3&gt;

&lt;h4&gt;Question&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;What is a useful strategy for code folding for Inquisit Scripts?&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;General discussion of code folding&lt;/h4&gt;

&lt;p&gt;I'm a huge fan of code folding in general, and in Vim specifically.
When done appropriately, code folding provides many benefits.
In particular, it makes large files easier to navigate, and it makes it
easier to get an overview of the contents of a file.&lt;/p&gt;

&lt;p&gt;After some reflection I have a few principles that I use to guide the design
of a folding scheme.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use the language
&lt;ul&gt;
&lt;li&gt;Folds should where possible take advantage of natural markers in the
programming language.&lt;/li&gt;
&lt;li&gt;Using built-in markers means that time does not need to be allocated
to the task of managing the creation of folds.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;Use unobtrusive markers
&lt;ul&gt;
&lt;li&gt;When markers are used that are not part of the language, they should
be simple an unobtrusive.&lt;/li&gt;
&lt;li&gt;Markers should not accidentally occur.&lt;/li&gt;
&lt;li&gt;This typically involves taking advantage of the commenting system in
the language.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;Two or three fold levels is typically sufficient
&lt;ul&gt;
&lt;li&gt;Too many folds creates navigational issues whereby excessive time is
spent navigating between folds.&lt;/li&gt;
&lt;li&gt;As a general rule I like it when the lowest level of folding contains
at least 5 or more lines and not much more than a page or page and a
half of text.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;Avoid Fold-1 - text - Fold-2 pattern
&lt;ul&gt;
&lt;li&gt;I.e., when a fold is expanded, there should not be a passage of
expanded text and then a lower level fold.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Inquisit scripts and code folding&lt;/h4&gt;

&lt;p&gt;Inquisit scripts are made up of elements that look somewhat like HTML.
Good coding practice suggests grouping related elements into sections.
This lead me to adopt the following folding scheme.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Level 1 folds
&lt;ul&gt;
&lt;li&gt;These are lines that begin with a single hash &lt;code&gt;#&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;As such they are not defined by the language, but the language permits
putting almost any text outside elements. &lt;/li&gt;
&lt;li&gt;They are designed to represent logical groups of Inquisit elements.&lt;/li&gt;
&lt;li&gt;I typically have sections for:
&lt;ul&gt;
&lt;li&gt;Experiment: a section that sets out any experiment level
information such as global variables, data format, random
allocation of subjects, and so forth.&lt;/li&gt;
&lt;li&gt;Blocks: a section that sets out each block in the experiment .&lt;/li&gt;
&lt;li&gt;One for each block: a section that contains all the trials,
stimuli, and item code for a given block.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;Level 2 folds
&lt;ul&gt;
&lt;li&gt;These represent each element.&lt;/li&gt;
&lt;li&gt;Thus, they are automatically created by the language.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;My code implementing folding for Inquisit scripts&lt;/h4&gt;

&lt;p&gt;The code below achieves this design.
It is placed in my &lt;code&gt;vimrc&lt;/code&gt; file.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;function! InquisitLevel(elements)
    " elements: 0 or 1
    if getline(v:lnum) =~ '^# .*$'
        return "&amp;gt;1"
    endif
    if a:elements &amp;amp;&amp;amp; getline(v:lnum) =~ '^&amp;lt;[a-zA-Z].*$'
        return "&amp;gt;2"
    endif
    return "=" 
endfunction                  
au BufEnter *.exp setlocal foldexpr=InquisitLevel(1)
au BufEnter *.exp setlocal foldmethod=expr
&lt;/code&gt;&lt;/pre&gt;

&lt;ul&gt;
&lt;li&gt;It contains a function that takes an argument called &lt;code&gt;elements&lt;/code&gt;.
If it is 0, then only section headings are folded and not elements.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;getline&lt;/code&gt; is a Vim function that returns the content of a line.
In this case &lt;code&gt;v:lnum&lt;/code&gt; is used by &lt;code&gt;expr&lt;/code&gt; fold method to indicate a
particular line number.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;=~&lt;/code&gt; is a logical operator that sees whether the text on the left is
matched by the regular expression on the right.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;'^# .*$'&lt;/code&gt; means match from the start of the line (&lt;code&gt;^&lt;/code&gt;) where the hash
character is in the first column, followed by a space, and then any number
(&lt;code&gt;*&lt;/code&gt;) of characters (&lt;code&gt;.&lt;/code&gt;) followed by the end of the line ( &lt;code&gt;$&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;If such a match does occur, then &lt;code&gt;return "&amp;gt;1"&lt;/code&gt; which means that heading 1
starts on that line.
See &lt;code&gt;h fold-expr&lt;/code&gt; for more information.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;a:elements&lt;/code&gt; is a variable that contains the value of the argument
&lt;code&gt;elements&lt;/code&gt; passed to the function.
The &lt;code&gt;a:&lt;/code&gt; is a necessary prefix for arguments.
In Vim 0 is false and 1 is true.
The double ampersand (&lt;code&gt;&amp;amp;&amp;amp;&lt;/code&gt;) is the logical AND operator.&lt;/li&gt;
&lt;li&gt;The second match matches lines that begin (&lt;code&gt;^&lt;/code&gt;) with the less than sign
followed by at least one alphabetical character and then any number of
additional arbitrary characters.
This provides a simple way that adequately matches for my purposes the
start of Inquisit elements.&lt;/li&gt;
&lt;li&gt;Thus, if &lt;code&gt;elements&lt;/code&gt; is non-zero and there is a match, this line is the
start of a level 2 heading (&lt;code&gt;"&amp;gt;2"&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;If no matches are obtained, a value of &lt;code&gt;=&lt;/code&gt; is returned, which tells &lt;code&gt;expr&lt;/code&gt;
to use the fold level of the previous line. &lt;/li&gt;
&lt;li&gt;The code is set up automatically using the two &lt;code&gt;au&lt;/code&gt; commands.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;BufEnter *.exp&lt;/code&gt; is an event that occurs when the buffer is entered
through file opening or buffer switching.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;*.exp&lt;/code&gt; is a file name filter. Thus, the command only works once the file
has a file names.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;foldexpr&lt;/code&gt; is a Vim setting that takes a custom function that determines
fold levels.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;foldmethod&lt;/code&gt; is a Vim setting that indicates the type of folding to use.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Using code folding&lt;/h4&gt;

&lt;p&gt;The main keys that I use for code folding are as follows.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;zj&lt;/code&gt; an &lt;code&gt;zk&lt;/code&gt; 
&lt;ul&gt;
&lt;li&gt;to move the cursor down and up between fold headings.&lt;/li&gt;
&lt;li&gt;This is not needed when text is already folded, but is useful when the
cursor is expanded text and I want to get the cursor to the previous
or next fold.&lt;/li&gt;
&lt;li&gt;I often use &lt;code&gt;zjzx&lt;/code&gt; to move down and show only the next fold.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;zc&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;to close a fold.&lt;/li&gt;
&lt;li&gt;I often follow this up with &lt;code&gt;j&lt;/code&gt; and &lt;code&gt;k&lt;/code&gt; to navigate over folds.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;zx&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;to show only the current fold.&lt;/li&gt;
&lt;li&gt;It is an awesome command that I use all the time. 
It functions like magnifying glass zooming in on the code of interest
while at the same time providing hierarchical context.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;zM&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;to close all folds to level 1.&lt;/li&gt;
&lt;li&gt;I often use &lt;code&gt;zMzx&lt;/code&gt; when folds have been expanded. This then gives the
effect of only showing the active fold.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;zR&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;to expand all folds.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;zO&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;to expand a single fold and its sub-folds.&lt;/li&gt;
&lt;li&gt;I often use this when a section of text has more folds than is
desirable.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Syntax highlighting&lt;/h3&gt;

&lt;h4&gt;Question&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;What is a basic syntax highlighting system for Inquisit scripts?&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Basic installation instructions&lt;/h4&gt;

&lt;p&gt;If all you want to do is make use of my syntax highlighting for Inquisit
files, follow these steps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Copy my syntax highlighting file for &lt;a href="
https://github.com/jeromyanglim/JA_Vimfiles/blob/master/syntax/inquisit.vim
"&gt;Inquisit files&lt;/a&gt; into your syntax directory in your custom vimfiles directory.&lt;/li&gt;
&lt;li&gt;Add the following command to your vimrc file &lt;code&gt;au BufEnter *.exp set ft=inquisit&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;It creates a file type called &lt;code&gt;inquisit&lt;/code&gt; that then lets Vim know that
it should apply the Inquisit syntax highlighting.&lt;/li&gt;
&lt;li&gt;Note that it assumes that you are using the standard &lt;code&gt;*.exp&lt;/code&gt; file
extension.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Screenshots&lt;/h4&gt;

&lt;p&gt;The following are some screenshots showing what the folding and syntax
highlighting look like with a &lt;code&gt;molokai&lt;/code&gt; colour scheme.&lt;/p&gt;

&lt;h5&gt;Image with sections folded&lt;/h5&gt;

&lt;p&gt;&lt;img src="http://i.imgur.com/DAWP2.png" title="image with sections folded" /&gt;&lt;/p&gt;

&lt;h5&gt;Image of folding with element expanded&lt;/h5&gt;

&lt;p&gt;&lt;img src="http://i.imgur.com/i2UwW.png" title="imge of folding with element
expanded" /&gt;&lt;/p&gt;

&lt;h5&gt;Basic image of the syntax highlighting&lt;/h5&gt;

&lt;p&gt;&lt;img src="http://i.imgur.com/DPIqa.png" title="basic image of the syntax
highlighting" /&gt;&lt;/p&gt;

&lt;h4&gt;Overview of writing the syntax highlighting file&lt;/h4&gt;

&lt;p&gt;Before describing the syntax file in more detail, I should present a
few caveats.
I am new to syntax files in Vim, and I am far from a master in regular
expressions.
I hacked out a syntax highlighting scheme that works for me, adequately.
It is far from perfect.
But I guess that's a lesson in itself when it comes to using Vim.
Vim allows for near infinite customisation, but you have to consider the
return on investment of any customisation efforts.&lt;/p&gt;

&lt;p&gt;In general, when developing the syntax file I had a look through a few
example syntax files for what I thought might be similar file types.
For every command that I did not understand I did Vim help searches.
And in general I just fiddled around with a sample Inquisit file open until
I got something that basically worked.
For people needing a little more regular expression training, there's a
great &lt;a href="http://vimregex.com/"&gt;Vim-oriented tutorial here&lt;/a&gt;.&lt;/p&gt;

&lt;h4&gt;Discussion of the syntax highlighting file&lt;/h4&gt;

&lt;p&gt;At the top of the file was the following:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;syntax case ignore
syn clear
&lt;/code&gt;&lt;/pre&gt;

&lt;ul&gt;
&lt;li&gt;This tells Vim that syntax highlighting should be case insensitive&lt;/li&gt;
&lt;li&gt;&lt;code&gt;syn clear&lt;/code&gt; clears any existing syntax highlighting applied to the file, although this
is often not required.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The syntax file then contains many &lt;code&gt;syn keyword&lt;/code&gt; commands, such as the
following:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;syn keyword inquisitElementKeyword contained survey 
syn keyword inquisitElementKeyword contained surveypage 
syn keyword inquisitElementKeyword contained textbox 
...
&lt;/code&gt;&lt;/pre&gt;

&lt;ul&gt;
&lt;li&gt;Words like &lt;code&gt;survey&lt;/code&gt;, &lt;code&gt;surveypage&lt;/code&gt;, etc. are all element names and keywords
within the language.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;keyword&lt;/code&gt; is a simple form of matching that matches the keyword
exactly without resorting to patterns.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;inquisitElementKeyword&lt;/code&gt; is a grouping name which I use later to assign
colours and show where such keywords are contained.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;contained&lt;/code&gt; keyword allows the scope of keywords to
be limited to only situations where they are contained within some other
syntactical structure.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The syntax file then contains code for matching operators, an example of
which is shown below:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;syn match inquisitOperator contained "||"
syn match inquisitOperator contained "&amp;amp;&amp;amp;"
&lt;/code&gt;&lt;/pre&gt;

&lt;ul&gt;
&lt;li&gt;This involved using the &lt;code&gt;match&lt;/code&gt; approach. 
This was required because the characters in operators are not alphabetical
characters.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I then added code to syntax highlight numbers.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;syn match inquisitNumber contained "\&amp;lt;[0-9%][0-9%]*"
&lt;/code&gt;&lt;/pre&gt;

&lt;ul&gt;
&lt;li&gt;The code shows the diverse options that &lt;code&gt;match&lt;/code&gt; provides.
It matches one or more numbers or the percent sign.
The combination of backslash and less-than-sign means that numbers must be
at the start of what Vim sees as a word.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then came some code to represent regions of text&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;syn region inquisitString start=+"+ end=+"+
&lt;/code&gt;&lt;/pre&gt;

&lt;ul&gt;
&lt;li&gt;The above code defined a &lt;code&gt;region&lt;/code&gt; based on quotation marks.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The plus sign is used as an alternate delimiter in order to indicate that 
the double quotes are the actual text used to match the start and end of
the region.&lt;/p&gt;

&lt;p&gt;syn region inquisitElementBlock start="&amp;lt;..*&gt;" end="&lt;/..*&gt;" transparent &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The above code represents an Inquisit element.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;The similarity with HTML tags may be apparent. &lt;/li&gt;
&lt;li&gt;&lt;p&gt;The &lt;code&gt;transparent&lt;/code&gt; keyword is used to indicate that this merely represents
a logical unit and does not impose any actual syntax highlighting.&lt;/p&gt;

&lt;p&gt;syn region inquisitAttributeKeyword contained start="\&amp;lt;" end="&gt;" 
syn region inquisitAttributeRegion start="\/" end="=" oneline contains=inquisitAttributeKeyword&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The above code creates a quick and dirty way of highlighting attribute
names in elements.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;Such attribute names always appear as a word contained between a slash and
an equals sign.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;\&amp;lt;&lt;/code&gt; and &lt;code&gt;\&amp;gt;&lt;/code&gt; match the start and end of a word, but this is contained.&lt;/li&gt;
&lt;li&gt;The second line indicates that the first line is contained in it.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;oneline&lt;/code&gt; keyword ensures that the match occurs entirely on one line.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;After some additional code comes the assignment of colours to groups.
The following are a few examples:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;hi link inquisitElementKeyword Keyword
hi link inquisitOperator Operator
hi link inquisitDelimiter Delimiter  
hi link inquisitString Character
&lt;/code&gt;&lt;/pre&gt;

&lt;ul&gt;
&lt;li&gt;Each command creates a highlighting link between the custom groups created
in the script and a common logical highlighting object used by many colour
schemes. &lt;/li&gt;
&lt;li&gt;In case you were interested, I use &lt;code&gt;molokai&lt;/code&gt; as my default colour scheme.
It is a popular dark scheme &lt;a href="
http://www.vim.org/scripts/script.php?script_id=2340"&gt;available from vim.org&lt;/a&gt;, and from &lt;a href="http://winterdom.com/2008/08/molokaiforvim"&gt;Thomas
Restrepo's blog&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Getting Inquisit Help while in Vim&lt;/h3&gt;

&lt;h4&gt;Question&lt;/h4&gt;

&lt;p&gt;Inquisit provides clear and well-organised documentation.
In Desktop Inquisit, pressing F1 in a script brings up the help for the
element under the cursor.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How can I make it easy to get help on Inquisit commands while continuing to
work within Vim?&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Discussion&lt;/h4&gt;

&lt;p&gt;The simplest strategy is just to keep a copy of the Inquisit help file open
while coding and type in search terms directly.
In the end, I have found this to be quite adequate.
However, I record some thoughts and ideas I explored for more automated
approaches below:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;HH "C:\Program Files\Millisecond Software\Inquisit 3\inquisit.chm"&lt;/code&gt; will open
Inquisit help (at least on my system given my installation path and version).&lt;/li&gt;
&lt;li&gt;Alternatively there is a online version of help: 
&amp;lt; http://www.millisecond.com/support/docs/v1/index.htm &gt;&lt;/li&gt;
&lt;li&gt;I asked &lt;a href="
http://stackoverflow.com/questions/4976872/command-line-options-for-hh-and-opening-chm-windows-help-files"&gt;a question on StackOverflow&lt;/a&gt;
for more information.&lt;/li&gt;
&lt;li&gt;I installed &lt;a href="http://www.keyworks.net/keyhh.htm"&gt;keyhh&lt;/a&gt;.
The following command basically did the trick:
&lt;code&gt;keyhh -#klink "data element" c:\Program Files\Millisecond Software\Inquisit 3\inquisit.chm&lt;/code&gt;
where &lt;code&gt;"data element"&lt;/code&gt; is a hypothetical search term.&lt;/li&gt;
&lt;li&gt;I also found &lt;a href="
https://github.com/vim-scripts/winhelp"&gt;this vimscript&lt;/a&gt;
designed to assist interaction with chm help files.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Future refinements&lt;/h3&gt;

&lt;p&gt;In the future I may:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Improve the syntax highlighting&lt;/li&gt;
&lt;li&gt;Introduce an Inquisit code formatting customisation&lt;/li&gt;
&lt;li&gt;Improve integration with the Inquisit language particularly with regard to
attributes&lt;/li&gt;
&lt;li&gt;Develop code that facilitates writing Inquisit scripts, such as sequences
of numbers for trial and block sequences&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;General lessons Learnt&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Tinkering with the syntax highlighting, folding, and command-line
interaction in Vim encouraged me to think more deeply about each feature
and how the feature could be optimised for my workflow.&lt;/li&gt;
&lt;li&gt;The ability to customise Vim as I have done here validates my decision to
adopt Vim. Vim encourages the development of amazing text editing shortcut
keys; the more they can be applied to the languages that I write in, the
better.&lt;/li&gt;
&lt;li&gt;Investment in customisation pays off both in terms of (a) making the immediate
task of programming in the given language easier, and (b) making it easier
to customise other languages in the future.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Additional Resources&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="
http://jeromyanglim.blogspot.com/2011/01/reasons-for-transitioning-to-vim.html"&gt;My Conversion to Vim&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="
http://jeromyanglim.blogspot.com/2009/10/practical-tips-on-how-to-conduct_05.html"&gt;Conducting an online experiment with Inquisit&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=Vn01-zPQZdU:61iEFKb4gEY:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=Vn01-zPQZdU:61iEFKb4gEY:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=Vn01-zPQZdU:61iEFKb4gEY:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=Vn01-zPQZdU:61iEFKb4gEY:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=Vn01-zPQZdU:61iEFKb4gEY:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=Vn01-zPQZdU:61iEFKb4gEY:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=Vn01-zPQZdU:61iEFKb4gEY:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=Vn01-zPQZdU:61iEFKb4gEY:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=Vn01-zPQZdU:61iEFKb4gEY:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/jeromyanglim/~4/Vn01-zPQZdU" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://jeromyanglim.blogspot.com/feeds/6319574097972116689/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://jeromyanglim.blogspot.com/2011/04/case-study-in-customising-syntax.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8909074830238091680/posts/default/6319574097972116689?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8909074830238091680/posts/default/6319574097972116689?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/jeromyanglim/~3/Vn01-zPQZdU/case-study-in-customising-syntax.html" title="Case Study in Customising Syntax Highlighting and Folding in Vim for a Niche Scripting Language Called Inquisit" /><author><name>Jeromy Anglim</name><uri>https://plus.google.com/100803004599943057656</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-xUmT1aa-RI0/AAAAAAAAAAI/AAAAAAAAAvk/eN47FjC3uVU/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://jeromyanglim.blogspot.com/2011/04/case-study-in-customising-syntax.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkYAR3o-fip7ImA9WhZRGEo.&quot;"><id>tag:blogger.com,1999:blog-8909074830238091680.post-8200857994209942209</id><published>2011-04-16T00:09:00.001+10:00</published><updated>2011-04-16T00:35:46.456+10:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-04-16T00:35:46.456+10:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="vim" /><category scheme="http://www.blogger.com/atom/ns#" term="markup" /><category scheme="http://www.blogger.com/atom/ns#" term="thinking" /><category scheme="http://www.blogger.com/atom/ns#" term="Word" /><title>Using Vim and VimOutliner as a Brainstorming and Outlining Tool</title><content type="html">&lt;p&gt;This post discuses using Vim as an outlining tool.
It focuses particularly on VimOutliner.
In particular the post
(a) discusses reasons why I like outlining tools, 
(b) presents some links for getting started and installing VimOutliner,
(c) presents my verdict on the personal utility of VimOutliner, and
(d) presents an assortment of little issues that I encountered and resolved while
learning to use VimOutliner.&lt;/p&gt;

&lt;a name='more'&gt;&lt;/a&gt;

&lt;h3&gt;Overview:&lt;/h3&gt;

&lt;p&gt;I've been a huge fan of outlining tools for more than ten years.
It all started when I stumbled on Outline View in MS Word.
I tweaked the settings a little bit, reducing the tab width to zero, and adding
a few additional shortcut keys and macros.&lt;/p&gt;

&lt;p&gt;I used Outline View to do much of my project-related brainstorming.
For example, if I had a yes/no decision to make, I'd type the name of the
problem with subheadings: description, yes, no, and decision.
The description would articulate the nature of the decision.
I'd then put reasons for yes, and reasons for no under their respective
headings.
This facilitated taking both perspectives.
Once I'd reached the decision, I could fold up the decision and move it from a
pending section to a resolved section.&lt;/p&gt;

&lt;p&gt;On a typical project there might 20, 30, or more decisions to be
made. &lt;br /&gt;
Using the hierarchical structure of Outline View allowed me to zoom in
and out of problems.
And this is but one example.
I used outlines for brainstorming, articulating problems, recording a log of
events, organising notes, and more.&lt;/p&gt;

&lt;p&gt;Of course, I'm not the first to discover the power of outlining.
Outlining is part of many people's brainstorming and thinking toolkit 
(see &lt;a href="
http://freemind.sourceforge.net/wiki/index.php/Main_Page"&gt;Free Mind for an open source mind mapping tool&lt;/a&gt;), 
&lt;a href="http://owl.english.purdue.edu/owl/resource/544/03/"&gt;this post on essay writing strategies&lt;/a&gt;,
etc.).&lt;/p&gt;

&lt;p&gt;The beauty of a tool like Outline View is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the ability to quickly manipulate the outline, promoting and demoting elements,
moving elements or whole trees up and down, and so on&lt;/li&gt;
&lt;li&gt;the ability to quickly navigate the outline&lt;/li&gt;
&lt;li&gt;the ability to selectively show elements of the outline&lt;/li&gt;
&lt;li&gt;Outline View also had benefits in that it had all the standard tools of MS
Word available.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;However, Outline View also had problems:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It was limited to 9 heading levels.&lt;/li&gt;
&lt;li&gt;Large files over about 200,000 words were often sluggish, and
sometimes crashed.&lt;/li&gt;
&lt;li&gt;It was difficult to convert the file into other formats.&lt;/li&gt;
&lt;li&gt;It lacked some fold navigation and viewing options, such as collapsing up a
fold or just showing the folds required to view the current line.&lt;/li&gt;
&lt;li&gt;Many of the keyboard shortcuts for Outline navigation and viewing required
movement of the hands from the home key position.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;VimOutliner&lt;/h3&gt;

&lt;p&gt;I previously posted about &lt;a href="
http://jeromyanglim.blogspot.com/2011/01/reasons-for-transitioning-to-vim.html
"&gt;my transition to using Vim&lt;/a&gt;.
As part of this transition, I was keen to bring as many tasks as possible into
Vim.
I saw the appeal of plain text.
I wanted to use cross-platform, open source tools.
I wanted to take advantage of the power of the text editing keys in Vim.
Thus, I wanted to switch from MS Word Outline View to an outliner in Vim.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.vim.org/scripts/script.php?script_id=2638"&gt;VimOutliner&lt;/a&gt; is a
major outlining tool for Vim. 
Raymon Li wrote &lt;a href="
  http://rayli.net/blog/2010/08/vimoutliner-windows-installation-howto/"&gt;instructions for installing VimOutliner on Windows&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Here are some additional links relevant to Vim, VimOutliner, and outlining more
broadly.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="
http://video.google.com/videoplay?docid=8810772602188234059#"&gt;Steve Lit has a video on VimOutliner&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="
https://github.com/vimoutliner/vimoutliner"&gt;The VimOutliner Plugin is also available on github&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="
http://www.troubleshooters.com/tpromag/199911/199911.htm"&gt;Discussion of Vim Outlines, Code, and Software by Steve Litt&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Peter Stuifzand wrote about using &lt;a href="
http://peterstuifzand.nl/gtd-vimoutliner.html"&gt;VimOutliner and GTD&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Org-mode&lt;/strong&gt;: I also hear great things about &lt;a href="
http://orgmode.org/"&gt;Emacs Org-Mode&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;There is also &lt;a href="https://github.com/hsitz/VimOrganizer"&gt;VimOrganiser&lt;/a&gt; which is
designed as a partial clone of Emacs org-mode. &lt;br /&gt;
But as of April 2011 it is at the relatively early stages of development. &lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Evaluation of VimOutliner after 3 months&lt;/h3&gt;

&lt;p&gt;At the time of posting I've been using Vim for around three months.
However, for the last month and half I have settled into a workflow that does
not involve VimOutliner.
Instead, I've switched to using &lt;a href="http://daringfireball.net/projects/markdown/"&gt;Markdown&lt;/a&gt;
in Vim with custom folding for my brainstorming.&lt;/p&gt;

&lt;p&gt;I'll talk more about my Markdown brainstorming setup at a later date
(for an overview of Markdown in Vim, see this &lt;a href="
http://net.tutsplus.com/tutorials/other/vim-essential-plugin-markdown-to-html/"&gt;video on Vim and Markdown&lt;/a&gt;
if you're curious).
However, in general my preference for using Markdown has largely flowed from the
benefits provided by Vim when working with text file formats.
Specifically in MS Word, Outline View relative to Normal View had the
advantage of being able to quickly hide and show the relevant text in a
hierarchical document.
However, Vim's folding tools can facilitate hiding and showing of text in a
variety of text formats.
Thus, with Markdown I can write text in a more structured format.
The content can more readily be used in other sources, such as blog posts.
Yet using Vim I can still hide and show relevant sections of text and move
sections around fluidly.                  &lt;/p&gt;

&lt;h3&gt;Assorted problems and solutions&lt;/h3&gt;

&lt;p&gt;The remainder of this post records a few challenges that I encountered when
getting oriented with VimOutliner. 
I've recorded them here in case they might be useful to others.
Bear in mind that they are effectively the working notes of someone new both to
Vim and VimOutliner.&lt;/p&gt;

&lt;h4&gt;1. Promote or demote multiple lines&lt;/h4&gt;

&lt;h5&gt;Question:&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;How can multiple lines be promoted or demoted?&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;Discussion:&lt;/h5&gt;

&lt;p&gt;Visual line selection approach:
1. &lt;code&gt;V&lt;/code&gt; to enter visual line mode 
* select lines to be promoted or demoted 
* &lt;code&gt;&amp;gt;&lt;/code&gt; or &lt;code&gt;&amp;lt;&lt;/code&gt; to demote or promote
* &lt;code&gt;.&lt;/code&gt; to repeat, &lt;code&gt;u&lt;/code&gt; to undo&lt;/p&gt;

&lt;p&gt;Collapsed fold approach:
1. collapse a fold (e.g., &lt;code&gt;zc&lt;/code&gt;) 
2. &lt;code&gt;&amp;gt;&amp;gt;&lt;/code&gt; or &lt;code&gt;&amp;lt;&amp;lt;&lt;/code&gt; to demote or promote&lt;/p&gt;

&lt;h4&gt;2. Tab width for outline files&lt;/h4&gt;

&lt;h5&gt;Question:&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;What is the best tab width for outlines?&lt;/li&gt;
&lt;li&gt;If this is different to the default setting, how can such a change be limited
to Vim Outlines?&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;Discussion:&lt;/h5&gt;

&lt;p&gt;Tab width of 2 might be better.&lt;/p&gt;

&lt;p&gt;I added the following commands to my Vimrc&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;au BufEnter *.otl setlocal tabstop = 2
au BufEnter *.otl setlocal shiftwidth=2
&lt;/code&gt;&lt;/pre&gt;

&lt;h4&gt;3. Using virtualedit&lt;/h4&gt;

&lt;h5&gt;Question:&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;Should &lt;code&gt;virtualedit&lt;/code&gt; be turned off when working with outline mode?&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;Discussion&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Enter&lt;/code&gt; in insert mode at the end of a heading line starts a new line with
proper indentation&lt;/li&gt;
&lt;li&gt;&lt;code&gt;o&lt;/code&gt; and &lt;code&gt;O&lt;/code&gt; in normal mode add new lines below and above the current heading
at the same heading level&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Thus, &lt;code&gt;vitualedit&lt;/code&gt; can be the source of formatting problems.
However, with care, this can be prevented, and I like virtualedit enough to not
turn it off for this file type.&lt;/p&gt;

&lt;h4&gt;4. Opening just subheadings&lt;/h4&gt;

&lt;h5&gt;Question:&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;How can a collapsed heading only be opened to show the first set of headings?&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;Discussion:&lt;/h5&gt;

&lt;p&gt;The documentation for VimOutliner does not mention this.
General Vim help on folding (&lt;code&gt;h folding&lt;/code&gt;) is relevant.
&lt;code&gt;zx&lt;/code&gt; and &lt;code&gt;zv&lt;/code&gt; are the two relevant key combinations.&lt;/p&gt;

&lt;h4&gt;5. Add heading below fold at same level as fold&lt;/h4&gt;

&lt;h5&gt;Question&lt;/h5&gt;

&lt;p&gt;I often edit a fold, fold it up and then want to add another level as a fold.
For example, take the following:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;text1
    text2.1
    text2.2
    text2.3
    text2.4
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I might want to fold up &lt;code&gt;text1&lt;/code&gt; to hide &lt;code&gt;text2.1&lt;/code&gt; to &lt;code&gt;text2.4&lt;/code&gt; and then want to
add a new heading at the same level as &lt;code&gt;text1&lt;/code&gt; below &lt;code&gt;test2.4&lt;/code&gt;.
Pressing &lt;code&gt;o&lt;/code&gt; adds a line below &lt;code&gt;text2.4&lt;/code&gt; at the same level as &lt;code&gt;text2.4&lt;/code&gt;.
How do I add a heading below &lt;code&gt;test2.4&lt;/code&gt;?&lt;/p&gt;

&lt;h5&gt;Discussion&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;Assume in insert mode&lt;/li&gt;
&lt;li&gt;Ensure cursor is actually on fold: &lt;code&gt;kj&lt;/code&gt; &lt;/li&gt;
&lt;li&gt;Move cursor to start of text &lt;code&gt;^&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Copy preceding tabs &lt;code&gt;y0&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Collapse headings again &lt;code&gt;zc&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Add line &lt;code&gt;o&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Exit mode &lt;code&gt;&amp;lt;ESC&amp;gt;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Paste tabs &lt;code&gt;P&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Enter insert mode at end of line &lt;code&gt;A&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And optionally&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Collapse unnecessary folds &lt;code&gt;&amp;lt;ESC&amp;gt;zx&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Return to insert mode &lt;code&gt;A&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Taken together and with some seemingly necessary tweaking, this makes:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;au FileType vo_base  map &amp;lt;leader&amp;gt;o kjzO^y0zco&amp;lt;Esc&amp;gt;0DPA&amp;lt;Esc&amp;gt;zxA
&lt;/code&gt;&lt;/pre&gt;

&lt;h5&gt;Issues&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;It does not work when body text is at the bottom
&lt;ul&gt;
&lt;li&gt;it adds an extra body text line&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;It sometimes does not work when the outline is corrupted 
&lt;ul&gt;
&lt;li&gt;it displays various error messages&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;It does not work when the heading is not folded
&lt;ul&gt;
&lt;li&gt;it leaves a blank line&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;6. Preventing outline file format corruption&lt;/h4&gt;

&lt;h5&gt;Question&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;What kinds of corruption of the outline file format can occur?&lt;/li&gt;
&lt;li&gt;How can this be prevented?&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;Discussion:&lt;/h5&gt;

&lt;p&gt;Spaces where tabs should be is a major source of problems.&lt;/p&gt;

&lt;p&gt;Outline format uses tabs for indentation.
In general, if spaces precede the first printed character, the file format
becomes corrupted.&lt;/p&gt;

&lt;p&gt;The following are common causes of this&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;spaces can be inserted by using space instead of tab&lt;/li&gt;
&lt;li&gt;spaces can be inserted when virtual edit is on&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Potential Resolutions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Prevent 
&lt;ul&gt;
&lt;li&gt;Disable virtualedit (i.e., &lt;code&gt;set virtualedit=""&lt;/code&gt;).
However, I like virtualedit and disabling it for one file type makes my
editing experience less consistent. 
So I chose not to do this.&lt;/li&gt;
&lt;li&gt;Follow the rule of always starting a new heading using a limited set of keys:
&lt;code&gt;Enter&lt;/code&gt;, &lt;code&gt;o&lt;/code&gt;, &lt;code&gt;O&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Always change heading level using standard keys:
&lt;ul&gt;
&lt;li&gt;Tab, Ctrl+D, Ctrl+T (insert mode)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&amp;gt;&amp;gt;&lt;/code&gt; &lt;code&gt;&amp;lt;&amp;lt;&lt;/code&gt; (normal mode)&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;Avoid leaving blank lines
&lt;ul&gt;
&lt;li&gt;If a new heading is created, but no text is entered, delete it before
moving the cursor.&lt;/li&gt;
&lt;li&gt;The above behaviour could be automated with a substitution command.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;Diagnose Problem
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;set list&lt;/code&gt; shows whether the characters preceding headings are all &lt;code&gt;^I&lt;/code&gt;
(&lt;code&gt;set nolist&lt;/code&gt;) turns this off.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;Fix
&lt;ul&gt;
&lt;li&gt;Manually replace spaces with tabs with assistance from &lt;code&gt;set list&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Use substitution to replace all problematic lines.
This could also be linked to an autocommand that automatically checks and
fixes problems&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;General Advice
&lt;ul&gt;
&lt;li&gt;See &lt;a href="
http://vim.wikia.com/wiki/Highlight_unwanted_spaces"&gt;this vimtip on highlighting unwanted white space&lt;/a&gt;
In the case of VimOutliner, this would be any space before the first
printed character in a line.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=S0siwXe960Y:Q-wG0ozYrqc:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=S0siwXe960Y:Q-wG0ozYrqc:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=S0siwXe960Y:Q-wG0ozYrqc:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=S0siwXe960Y:Q-wG0ozYrqc:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=S0siwXe960Y:Q-wG0ozYrqc:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=S0siwXe960Y:Q-wG0ozYrqc:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=S0siwXe960Y:Q-wG0ozYrqc:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=S0siwXe960Y:Q-wG0ozYrqc:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=S0siwXe960Y:Q-wG0ozYrqc:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/jeromyanglim/~4/S0siwXe960Y" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://jeromyanglim.blogspot.com/feeds/8200857994209942209/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://jeromyanglim.blogspot.com/2011/04/using-vim-and-vimoutliner-as.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8909074830238091680/posts/default/8200857994209942209?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8909074830238091680/posts/default/8200857994209942209?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/jeromyanglim/~3/S0siwXe960Y/using-vim-and-vimoutliner-as.html" title="Using Vim and VimOutliner as a Brainstorming and Outlining Tool" /><author><name>Jeromy Anglim</name><uri>https://plus.google.com/100803004599943057656</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-xUmT1aa-RI0/AAAAAAAAAAI/AAAAAAAAAvk/eN47FjC3uVU/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://jeromyanglim.blogspot.com/2011/04/using-vim-and-vimoutliner-as.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEcERnk7fCp7ImA9WhBWE0U.&quot;"><id>tag:blogger.com,1999:blog-8909074830238091680.post-617591034496748746</id><published>2011-03-30T15:36:00.004+11:00</published><updated>2013-04-08T10:46:47.704+10:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-04-08T10:46:47.704+10:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="statistics" /><category scheme="http://www.blogger.com/atom/ns#" term="statistical consulting" /><category scheme="http://www.blogger.com/atom/ns#" term="teaching" /><title>How to Ask Me a Statistics Question</title><content type="html">This post includes instructions on how to ask me a written statistics
question.&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;h5&gt;
The old way&lt;/h5&gt;
I receive a lot of statistics questions by email.
Answering such questions by email is inefficient.&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;A lot of questions re-occur.&lt;/li&gt;
&lt;li&gt;Answers only help a single person.&lt;/li&gt;
&lt;li&gt;Senders only get my suggestions, and not suggestions from other experts.&lt;/li&gt;
&lt;li&gt;Sender do not get much feedback on how to improve in the art of
writing effective questions.&lt;/li&gt;
&lt;/ul&gt;
&lt;h5&gt;
A better way&lt;/h5&gt;
A better model involves using &lt;a href="http://stats.stackexchange.com/"&gt;http://stats.stackexchange.com&lt;/a&gt; . 
It offers many benefits.&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Many experts have an opportunity to provide an answer.&lt;/li&gt;
&lt;li&gt;The questions can be improved and refined.&lt;/li&gt;
&lt;li&gt;Questions and answers are accessible from search engines.
Thus, the question and answers become an ongoing Internet resource that
are typically read by many hundreds of people.&lt;/li&gt;
&lt;li&gt;The answers are under a Creative Commons licence which means that they can
be reused in other forms.&lt;/li&gt;
&lt;li&gt;Learning to write effective questions on question and answer sites is an
important skill.&lt;/li&gt;
&lt;/ul&gt;
&lt;h5&gt;
Procedure for asking a question&lt;/h5&gt;
&lt;ol&gt;
&lt;li&gt;Go to &lt;a href="http://stats.stackexchange.com/"&gt;http://stats.stackexchange.com/&lt;/a&gt; .&lt;/li&gt;
&lt;li&gt;Create an account 
&lt;ul&gt;
&lt;li&gt;You can create an account with a non-identifying user name if
you prefer.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Read the &lt;a href="http://stats.stackexchange.com/faq"&gt;FAQ&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Click &lt;a href="http://stats.stackexchange.com/questions/ask"&gt;ASK QUESTION&lt;/a&gt;.
&lt;ul&gt;
&lt;li&gt;Enter your question title, description, and any relevant tags.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h5&gt;
Important things to remember:&lt;/h5&gt;
&lt;ul&gt;
&lt;li&gt;Be prepared to edit your question to provide additional information in
response to comments; be prepared to respond to people who propose answers
and explain why the answer is helpful or not.
Asking a question is only the beginning of the process.
The people answering the question are volunteers who are often motivated
to create a question and answer combination that will be helpful for others
in the future. 
You should try to facilitate this process.&lt;/li&gt;
&lt;li&gt;When asking questions, show what initial research you have
done to answer the question (e.g., Google searches, reading a textbook).&lt;/li&gt;
&lt;li&gt;Try to extract the general question out of the specifics of your project,
so that answers will be of greater use for future readers.&lt;/li&gt;
&lt;li&gt;Include background information that might be needed in order to answer
your question effectively.&lt;/li&gt;
&lt;li&gt;If your question includes multiple parts, then you may need to ask
separate questions.&lt;/li&gt;
&lt;li&gt;If you are concerned about anonymity, create a user name that is
non-identifying, and, if necessary, tweak your question to make any
project-specific details a little more abstract.&lt;/li&gt;
&lt;li&gt;Your question may be clearer if you break up your question into (a) context;
(b) questions; and where appropriate (c) your initial answers.&lt;/li&gt;
&lt;li&gt;If your background is psychology, be aware that users on
stats.stackexchange have diverse backgrounds. Clearly explain any
psychological terms or concepts.&lt;/li&gt;
&lt;/ul&gt;
&lt;h5&gt;
Asking me a question&lt;/h5&gt;
&lt;ul&gt;
&lt;li&gt;If you are a research student or academic where I work in the School of Psychology, Deakin University, then send me the URL to the question by email, and I will do my best to answer your question.&lt;/li&gt;
&lt;li&gt;For all others, if you don't get a good answer in a few days and you think that I'd be well suited
to answering the question, feel free to send me an email including the web
address for the question, or post it below.
Of course, I can't promise that I'll have time to answer the question.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=2DRyc_Vkad4:GVPrv3_EuNM:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=2DRyc_Vkad4:GVPrv3_EuNM:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=2DRyc_Vkad4:GVPrv3_EuNM:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=2DRyc_Vkad4:GVPrv3_EuNM:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=2DRyc_Vkad4:GVPrv3_EuNM:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=2DRyc_Vkad4:GVPrv3_EuNM:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=2DRyc_Vkad4:GVPrv3_EuNM:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=2DRyc_Vkad4:GVPrv3_EuNM:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=2DRyc_Vkad4:GVPrv3_EuNM:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/jeromyanglim/~4/2DRyc_Vkad4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://jeromyanglim.blogspot.com/feeds/617591034496748746/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://jeromyanglim.blogspot.com/2011/03/how-to-ask-me-statistics-question.html#comment-form" title="7 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8909074830238091680/posts/default/617591034496748746?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8909074830238091680/posts/default/617591034496748746?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/jeromyanglim/~3/2DRyc_Vkad4/how-to-ask-me-statistics-question.html" title="How to Ask Me a Statistics Question" /><author><name>Jeromy Anglim</name><uri>https://plus.google.com/100803004599943057656</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-xUmT1aa-RI0/AAAAAAAAAAI/AAAAAAAAAvk/eN47FjC3uVU/s512-c/photo.jpg" /></author><thr:total>7</thr:total><feedburner:origLink>http://jeromyanglim.blogspot.com/2011/03/how-to-ask-me-statistics-question.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEQHSHk8fSp7ImA9Wx9bEkg.&quot;"><id>tag:blogger.com,1999:blog-8909074830238091680.post-1088538028809176212</id><published>2011-02-21T13:45:00.000+11:00</published><updated>2011-02-21T13:45:39.775+11:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-02-21T13:45:39.775+11:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="modelling" /><category scheme="http://www.blogger.com/atom/ns#" term="R" /><title>R Optimisation Tips using Optim and Maximum Likelihood</title><content type="html">&lt;p&gt;This post summarises some R modelling tips I picked up at
&lt;a href="http://www.psych.unimelb.edu.au/AMPC2011/index.htm"&gt;AMPC2011&lt;/a&gt;.&lt;/p&gt;

&lt;a name='more'&gt;&lt;/a&gt;

&lt;p&gt;I got some tips from a tutorial on parameter estimation
put on by &lt;a href="http://www.newcl.org/?q=node/50"&gt;Scott Brown&lt;/a&gt;from the 
 &lt;a href="http://www.newcl.org/"&gt;Newcastle Cognition Lab&lt;/a&gt;.
The R code used in the tutorial is available &lt;a href="
http://www.psych.unimelb.edu.au/AMPC2011/rt.zip"&gt;directly here&lt;/a&gt;
or from the &lt;a href="
http://www.psych.unimelb.edu.au/AMPC2011/index.htm"&gt;conference website&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The main tips I took from the tutorial were:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Consider using &lt;a href="http://en.wikipedia.org/wiki/Bayesian_information_criterion"&gt;BIC&lt;/a&gt;
as a model comparison criterion.&lt;/li&gt;
&lt;li&gt;When modelling reaction times, consider modelling data as a mixture model of
two processes. One process is the main process of experimental interest and
another is a secondary process that otherwise contributes noise.
The secondary process is used to capture what would otherwise be outliers that
flow, particularly, from very slow reaction times observed when participants
get distracted.
Probability assigned to the two processes
can be specified a priori based on knowledge of the experimental phenomena.
In the specific example that Scott showed, the outlier process was given a
probability of 0.03 and this was treated as a uniform distribution between 0
and the trial time-out time.&lt;/li&gt;
&lt;li&gt;Consider transformations model parameters for the purpose of estimation and
then converting the transformed parameters back to their original scale.
This can facilitate estimation and also assist in enforcing psychologically
meaningful constraints on parameter values (e.g., ensuring that asymptotic
reaction time is greater than zero).&lt;/li&gt;
&lt;li&gt;The combination of the R function &lt;code&gt;optim&lt;/code&gt; and a custom created objective
function, such as a minus log-likelihood function provides a powerful tool for
parameter estimation of custom models. &lt;br /&gt;
&lt;ul&gt;&lt;li&gt;&lt;a href="
http://www.psych.unimelb.edu.au/AMPC2011/rt.zip"&gt;Scott Brown's tutorial&lt;/a&gt; includes an example of
this.&lt;/li&gt;
&lt;li&gt;&lt;a href="
http://www.mayin.org/ajayshah/KB/R/documents/mle/mle.html"&gt;Ajay Shah has an example&lt;/a&gt;
of writing a likelihood function and then getting a maximum likelihood
estimate using &lt;code&gt;optim&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Benjamin Bolker has great material available on the web from his book
&lt;a href="http://www.math.mcmaster.ca/~bolker/emdbook/index.html"&gt;Ecological Models and Data in R&lt;/a&gt;.
PDFs, Rnw, and R code for early versions of the chapters are provided on
the website.
Chapter 6 (&lt;a href="http://www.math.mcmaster.ca/~bolker/emdbook/chap6A.pdf"&gt;likelihood and all that&lt;/a&gt;)
, 7 (&lt;a href="http://www.math.mcmaster.ca/~bolker/emdbook/chap7A.pdf"&gt;the gory details of model fitting&lt;/a&gt;),
and 8 (&lt;a href="http://www.math.mcmaster.ca/~bolker/emdbook/chap8A.pdf"&gt;worked likelihood estimation examples&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;Brian Ripley has a &lt;a href="
http://www.stats.ox.ac.uk/~ruth/RCourse/Rcourse54up.pdf"&gt;set of slides on simulation and optimisation in R&lt;/a&gt;. 
In particular it provides a useful discussion of the various optimisation
algorithms available using &lt;code&gt;optim&lt;/code&gt;.&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;I also got the impression that it will soon be time to dive into &lt;a href="
http://www.mrc-bsu.cam.ac.uk/bugs/"&gt;WinBUGS&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=f3G7kN5iCT8:H6rhH6BN9AQ:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=f3G7kN5iCT8:H6rhH6BN9AQ:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=f3G7kN5iCT8:H6rhH6BN9AQ:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=f3G7kN5iCT8:H6rhH6BN9AQ:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=f3G7kN5iCT8:H6rhH6BN9AQ:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=f3G7kN5iCT8:H6rhH6BN9AQ:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=f3G7kN5iCT8:H6rhH6BN9AQ:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=f3G7kN5iCT8:H6rhH6BN9AQ:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=f3G7kN5iCT8:H6rhH6BN9AQ:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/jeromyanglim/~4/f3G7kN5iCT8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://jeromyanglim.blogspot.com/feeds/1088538028809176212/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://jeromyanglim.blogspot.com/2011/02/r-optimisation-tips-using-optim-and.html#comment-form" title="6 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8909074830238091680/posts/default/1088538028809176212?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8909074830238091680/posts/default/1088538028809176212?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/jeromyanglim/~3/f3G7kN5iCT8/r-optimisation-tips-using-optim-and.html" title="R Optimisation Tips using Optim and Maximum Likelihood" /><author><name>Jeromy Anglim</name><uri>https://plus.google.com/100803004599943057656</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-xUmT1aa-RI0/AAAAAAAAAAI/AAAAAAAAAvk/eN47FjC3uVU/s512-c/photo.jpg" /></author><thr:total>6</thr:total><feedburner:origLink>http://jeromyanglim.blogspot.com/2011/02/r-optimisation-tips-using-optim-and.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0AGSXkyfCp7ImA9Wx9bEkg.&quot;"><id>tag:blogger.com,1999:blog-8909074830238091680.post-4183686649943021469</id><published>2011-02-21T13:33:00.001+11:00</published><updated>2011-02-21T13:35:28.794+11:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-02-21T13:35:28.794+11:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="psychology" /><category scheme="http://www.blogger.com/atom/ns#" term="Sweave" /><category scheme="http://www.blogger.com/atom/ns#" term="R" /><title>R versus Matlab in Mathematical Psychology</title><content type="html">&lt;p&gt;I recently attended the 2011 Australasian Mathematical Psychology Conference.
This post summarises a few thoughts I had on the use of R, Matlab and other
tools in mathematical psychology flowing from discussions with researchers at
the conference.
&lt;a name='more'&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I wanted to get a sense of the software used by researchers in mathematical
psychology.
What was popular?
Why was it popular?
From the small-n, non-random sample of conference attendees that I spoke to over
coffee and cake, I concluded:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Many experienced math psych researchers know a bit of both R and Matlab, but
most specialised in one. &lt;br /&gt;&lt;/li&gt;
&lt;li&gt;Matlab seemed to be substantially more popular than R in math psych.&lt;/li&gt;
&lt;li&gt;The general attitude seemed to be that both tools offered similar
functionality.&lt;/li&gt;
&lt;li&gt;Reasons given for using Matlab:
&lt;ul&gt;&lt;li&gt;Consistency: several researchers commented that functions are highly
consistent in Matlab, making it easier to return to coding in Matlab after
a break.&lt;/li&gt;
&lt;li&gt;Superior built-in documentation: 
There was a sense that Matlab documentation was more user-friendly.&lt;/li&gt;
&lt;li&gt;Historical precedent: researchers grew up on Matlab and then taught it to
their graduate students.&lt;/li&gt;
&lt;li&gt;Existing packages and models: it seems like Matlab is well established in
cognitive psychology where substantial existing code to guide subsequent
researchers.&lt;/li&gt;
&lt;li&gt;University pays: Thus, while R is free, Matlab is effectively free to the
academic if the academic's university has a site licence.&lt;/li&gt;
&lt;li&gt;User friendly IDE: 
In R it seems that most users pretty quickly start playing around with
alternative editors, whether it be ESS, Vim and R, Eclipse, Tinn-R or
something else. In Matlab, the built-in IDE seemed popular.
While these external editors can be configured to create a really powerful
data analytic environment, Matlab users appreciated having something that
was productive out-of-the-box.&lt;/li&gt;
&lt;li&gt;Matlab is user friendly for implementing matrix algebra based
calculations.&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;Reasons given for using R:
&lt;ul&gt;&lt;li&gt;Free (as in beer)&lt;/li&gt;
&lt;li&gt;Open source: A few people talked about this. However, I got the sense
that the ideology of open source technology could be encouraged further.&lt;/li&gt;
&lt;li&gt;Sweave: Even amongst Matlab users, there was a respect and interest in the
idea of &lt;a href="http://www.stat.uni-muenchen.de/~leisch/Sweave/"&gt;Sweave in R&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;R's packages: The sheer number of packages particularly for statistics is
one of R's great strengths.&lt;/li&gt;
&lt;li&gt;Superior graphics&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;A few people also spoke positively of Python (see this summary of 
&lt;a href="
http://aliquote.org/memos/2011/02/07/python-for-statistical-computing"&gt;useful Python packages for statistics&lt;/a&gt;
by Christophe Lalanne.&lt;/li&gt;
&lt;li&gt;All the above links into general discussion of the relative merits of 
&lt;a href="
http://stackoverflow.com/questions/2264974/psychology-researcher-wants-to-learn-new-language"&gt;R, Matlab, and Python on SO&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;From my discussions, I saw no need for me to personally switch from R to Matlab.
Sweave, graphics, and all the R packages are fantastic.
The community around R is also one of its great strengths.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://stackoverflow.com/questions/tagged/r"&gt;R StackOverflow&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href="http://twitter.com/#!/search/%23rstats"&gt;Rstats on Twitter&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://tolstoy.newcastle.edu.au/R/"&gt;R Help&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://stats.stackexchange.com/questions/tagged/r"&gt;R on Cross Validated&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://blog.revolutionanalytics.com/local-r-groups.html
"&gt;Local R User Groups&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.r-bloggers.com/"&gt;R Bloggers&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Finally, open source just aligns better with science.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Open and freely modifiable source code&lt;/li&gt;
&lt;li&gt;Freely available psychological measurement tools&lt;/li&gt;
&lt;li&gt;Freely available data&lt;/li&gt;
&lt;li&gt;Reproducible research documents using technologies such as Sweave&lt;/li&gt;
&lt;li&gt;Open-access journals&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It all combines to support scientific disciplines in 
sharing and building knowledge through accountability and trust.
This applies both to sharing between researchers as well as communicating with
the broader community.&lt;/p&gt;

&lt;p&gt;I get a bad feeling when I think of researchers and interested community members
who can't afford Matlab being excluded from research.&lt;/p&gt;

&lt;p&gt;However, it was interesting to consider how issues like user-friendly
documentation, development environments, and consistency could be facilitated in
a massive and distributed open source project such as R.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;...END RANT...&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;Related Posts&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="
http://jeromyanglim.blogspot.com/2010/02/getting-started-with-sweave-r-latex.html"&gt;Getting Started with Sweave&lt;/a&gt; &lt;br /&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="
http://jeromyanglim.blogspot.com/2009/06/learning-r-for-researchers-in.html"&gt;Learning R in Psychology&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="
http://jeromyanglim.blogspot.com/2010/12/r-workflow-slides-from-talk-at.html"&gt;Links to Example Sweave Documents&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;David Hiebeler's &lt;a href="
http://cran.r-project.org/doc/contrib/Hiebeler-MatlabR.pdf"&gt;Matlab to R translation document&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=OhOxr-zhJLw:LJCG2YToYxA:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=OhOxr-zhJLw:LJCG2YToYxA:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=OhOxr-zhJLw:LJCG2YToYxA:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=OhOxr-zhJLw:LJCG2YToYxA:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=OhOxr-zhJLw:LJCG2YToYxA:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=OhOxr-zhJLw:LJCG2YToYxA:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=OhOxr-zhJLw:LJCG2YToYxA:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=OhOxr-zhJLw:LJCG2YToYxA:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=OhOxr-zhJLw:LJCG2YToYxA:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/jeromyanglim/~4/OhOxr-zhJLw" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://jeromyanglim.blogspot.com/feeds/4183686649943021469/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://jeromyanglim.blogspot.com/2011/02/r-versus-matlab-in-mathematical.html#comment-form" title="6 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8909074830238091680/posts/default/4183686649943021469?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8909074830238091680/posts/default/4183686649943021469?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/jeromyanglim/~3/OhOxr-zhJLw/r-versus-matlab-in-mathematical.html" title="R versus Matlab in Mathematical Psychology" /><author><name>Jeromy Anglim</name><uri>https://plus.google.com/100803004599943057656</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-xUmT1aa-RI0/AAAAAAAAAAI/AAAAAAAAAvk/eN47FjC3uVU/s512-c/photo.jpg" /></author><thr:total>6</thr:total><feedburner:origLink>http://jeromyanglim.blogspot.com/2011/02/r-versus-matlab-in-mathematical.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CE8MRX4yeSp7ImA9Wx9XF08.&quot;"><id>tag:blogger.com,1999:blog-8909074830238091680.post-6913591354801474312</id><published>2011-01-11T15:30:00.002+11:00</published><updated>2011-01-11T16:14:44.091+11:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-01-11T16:14:44.091+11:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="vim" /><category scheme="http://www.blogger.com/atom/ns#" term="R" /><title>Reasons for Transitioning to Vim: Bringing LaTeX, R, Sweave and More under One Roof</title><content type="html">&lt;p&gt;This post describes the reasons for my transition to Vim.&lt;/p&gt;

&lt;a name='more'&gt;&lt;/a&gt;

&lt;h3&gt;Brief Background&lt;/h3&gt;

&lt;p&gt;Over the years I've used a lot of different text editors on Windows.
In general, I've used whatever text editor came with a program.
When I started using R, I moved from Rgui through Tinn-R, JGR, and others,
finally settling in to really enjoy the StatET plugin in Eclipse.
When I started using LaTeX, I tried TexnicCenter, WinEdt, and Texlipse.
Each program had the standard Windows shortcut keys and often a few extra ones
for tasks such as deleting lines and toggling comments.
However, these novel shortcut keys varied between programs.&lt;/p&gt;

&lt;p&gt;I've acquired some fairly good skills in using Windows' admittedly limited set of
standard text editing features.
For example, I was comfortable pressing &lt;code&gt;Ctrl+Shift+Right&lt;/code&gt; to select a word.
I even developed and learnt a custom set of key bindings that allowed me to use
the navigation and cursor keys from the home key position
(&lt;a href="
http://jeromyanglim.blogspot.com/2010/07/how-to-edit-text-faster-on-windows-by.html"&gt;see my earlier post&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;Nonetheless, this wasn't enough.
I wanted something more powerful, more consistent, more "awesome".&lt;/p&gt;

&lt;h3&gt;Reasons for Adopting Vim&lt;/h3&gt;

&lt;h4&gt;Frustration with Previous Tools&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;I was &lt;strong&gt;hitting a wall in Eclipse&lt;/strong&gt;.
The StatET plugin for Eclipse has some excellent features which make working
with R really nice 
(&lt;a href="
http://jeromyanglim.blogspot.com/2010/02/getting-started-with-sweave-r-latex.html"&gt;see my earlier blog post&lt;/a&gt; 
However, there were a few tasks that I could not easily automate.
For example, I couldn't get decent code folding or an outline view for Sweave
files.
I couldn't develop a quick keyboard shortcut to send the R code in &lt;code&gt;\Sexpr{}&lt;/code&gt; to
the R console.
There was no key to switch consoles.
I could go on.
I could see no easy way to introduce the desired customisation.
No doubt the customisations were possible, but it meant diving into a whole world
of complexity or hoping that one day someone else would write a plugin to meet
my particular needs.
I could describe a similar experience with WinEdt.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Readiness for Vim&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;I'd already adopted a &lt;strong&gt;plain-text--command-line workflow&lt;/strong&gt;.
LaTeX for documents; 
R for data analysis; 
Beamer for presentations;
Make for building programs;
Markdown for writing blog posts.
This meant that I could do most of my daily tasks in a text editor. 
There was also the possibility that with Vim I could bring in other tasks into a
more integrated environment (e.g., outlining, task lists, etc.).
When I was first learning LaTeX, R, the command-line, and so on, it was useful
to have software that held my hand a little bit.
After getting comfortable with such things, Vim is just one additional step.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The main markup and programming languages that I use already had decent
support in Vim (e.g., R, LaTeX, etc.).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Vim Matched My Orientation&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;I like the &lt;strong&gt;philosophy of Vim&lt;/strong&gt;.
I touch type. 
I learn shortcut keys.
I use AutoHotKey.
I despise unnecessary movement of the hands to the cursor keys or the mouse.
Vim is built for efficiency.
Vim is built for using the keyboard.
I'm happy to invest a little effort to get this efficiency.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;I watched &lt;strong&gt;Derek Wyatt&lt;/strong&gt;'s awesome, funny, and informative videos on Vim. 
&lt;a href="http://www.derekwyatt.org/vim/vim-tutorial-videos/vim-novice-tutorial-videos/"&gt;http://www.derekwyatt.org/vim/vim-tutorial-videos/vim-novice-tutorial-videos/&lt;/a&gt;
I related to what Derek was saying. 
I related to the "Notepad-wall". 
I liked an editor that saw the mouse as an "evil" "rat-tailed beast".
I liked an editor that saw moving the hands from the home key position as a health
hazard.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Great Features of Vim&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Vim was invented in 1991 and Vi goes back much further
(&lt;a href="http://en.wikipedia.org/wiki/Vim_(text_editor"&gt;see Wikipedia&lt;/a&gt;)).
It's still very popular.
Whenever I learn shortcut keys and introduce software customisations, I am
paying a present cost for future time savings.
Future time savings come both from the fact that the software is still supported
and that I don't drop the software because I find something better.
Vim has been around for a long time, is open source, and has an active developer
community. 
Thus, it feels like it will be around for a long time to come.
Also, given that many coding gurus use Vim, I'm hoping I wont be switching to
another tool any time soon (but I guess we'll have to see).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The &lt;a href="
http://stackoverflow.com/questions/1711/what-is-the-single-most-influential-book-every-programmer-should-read/1735#1735"&gt;Pragmatic Programmer&lt;/a&gt;
says that you should learn at least &lt;strong&gt;one powerful text editor&lt;/strong&gt; really well.
The main two options seem to be Vim and Emacs.
At this point I've been lured by the elegance of the mode-based approach to text
editing in Vim.
However, as with a lot of things, I feel the more important point is that I move
my workflow to either Emacs or Vim.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The system for saving settings in Vim gives me more confidence that I can roll
over my &lt;strong&gt;customisations&lt;/strong&gt; easily to other machines.
Eclipse always felt a bit mysterious regarding how and where customisations
would be stored.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Vim appears to &lt;strong&gt;lack "deal-breakers"&lt;/strong&gt;. 
By deal-breakers I refer to something about a piece of software that is so
frustrating that you just can't use it.
While most software can be frustrating at times, it should be simple enough to
customise the software to overcome the problem.
With Vim customisation is a natural extension of the editor.
With Eclipse, some useful customisation is possible, but there also feels like
there is a wall.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Building on the previous point &lt;strong&gt;customisation is a natural extension&lt;/strong&gt; of the
software. 
Vim is similar to R in this respect.
While a lot of programs have a more advanced scripting language to add
customisations, they don't all facilitate the gradual transition towards greater
use of this scripting language.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Conclusion&lt;/h4&gt;

&lt;p&gt;Expect to see several upcoming posts on Vim as I begin to incorporate Vim into my
workflow using R, LaTeX, and other tools.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/search/label/"&gt;Other Posts on Vim&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=kEJW2tsdzsk:aZjd4N3pHuo:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=kEJW2tsdzsk:aZjd4N3pHuo:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=kEJW2tsdzsk:aZjd4N3pHuo:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=kEJW2tsdzsk:aZjd4N3pHuo:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=kEJW2tsdzsk:aZjd4N3pHuo:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=kEJW2tsdzsk:aZjd4N3pHuo:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=kEJW2tsdzsk:aZjd4N3pHuo:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=kEJW2tsdzsk:aZjd4N3pHuo:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=kEJW2tsdzsk:aZjd4N3pHuo:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/jeromyanglim/~4/kEJW2tsdzsk" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://jeromyanglim.blogspot.com/feeds/6913591354801474312/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://jeromyanglim.blogspot.com/2011/01/reasons-for-transitioning-to-vim.html#comment-form" title="23 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8909074830238091680/posts/default/6913591354801474312?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8909074830238091680/posts/default/6913591354801474312?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/jeromyanglim/~3/kEJW2tsdzsk/reasons-for-transitioning-to-vim.html" title="Reasons for Transitioning to Vim: Bringing LaTeX, R, Sweave and More under One Roof" /><author><name>Jeromy Anglim</name><uri>https://plus.google.com/100803004599943057656</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-xUmT1aa-RI0/AAAAAAAAAAI/AAAAAAAAAvk/eN47FjC3uVU/s512-c/photo.jpg" /></author><thr:total>23</thr:total><feedburner:origLink>http://jeromyanglim.blogspot.com/2011/01/reasons-for-transitioning-to-vim.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CE4ARXc-eip7ImA9Wx9QFU8.&quot;"><id>tag:blogger.com,1999:blog-8909074830238091680.post-509755131525445939</id><published>2010-12-28T18:55:00.000+11:00</published><updated>2010-12-28T18:55:44.952+11:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-12-28T18:55:44.952+11:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="summary post" /><title>2010 in Review: 99 Most Popular Pages on Jeromy Anglim's Blog</title><content type="html">In the spirit of taking stock of the year that's been,
 and in the spirit of festive television repeats, 
 this post reviews 2010 for this blog.

&lt;a name='more'&gt;&lt;/a&gt;

&lt;h3&gt;2010 in Review&lt;/h3&gt;

&lt;p&gt;It has been a satisfying year of blogging.
Subscribers have grown from 70 to around 390.
Annual site visits have grown from 10,000 in 2009 to around 94,000
in 2010.&lt;/p&gt;

&lt;p&gt;I've also enjoyed getting involved with
 &lt;a href="http://www.crossvalidated.com/"&gt;CrossValidated&lt;/a&gt;,
 &lt;a href="
 http://www.meetup.com/MelbURN-Melbourne-Users-of-R-Network/"&gt;Melbourne R Users&lt;/a&gt;,
 &lt;a href="
 http://www.r-bloggers.com/"&gt;R-Bloggers&lt;/a&gt;,
 &lt;a href="
 https://github.com/jeromyanglim"&gt;github&lt;/a&gt;,
 and &lt;a href="
 http://twitter.com/#!/jeromyanglim"&gt;Twitter&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I'm looking forward to posting more in 2011 on
 Sweave, reproducible research, R packages, unit testing,
 and more.&lt;/p&gt;

&lt;p&gt;To all the readers of this blog, all the best for New Years
and the year ahead.&lt;/p&gt;

&lt;h3&gt;Most Popular Pages for 2010&lt;/h3&gt;

&lt;p&gt;The following were the 99 most popular blog pages 
for 2010 (with 2010 page views in brackets)
courtesy of &lt;a href="http://www.google.com/analytics/"&gt;Google Analytics&lt;/a&gt;.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2010/05/videos-on-data-analysis-with-r.html"&gt;videos-on-data-analysis-with-r&lt;/a&gt; (6353)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2009/09/recovering-corrupted-excel-2007-file.html"&gt;recovering-corrupted-excel-2007-file&lt;/a&gt; (5358)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2009/09/how-to-write-literature-review-in.html"&gt;how-to-write-literature-review-in&lt;/a&gt; (4180)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2010/03/apa-style-references-in-latex.html"&gt;apa-style-references-in-latex&lt;/a&gt; (3348)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2010/02/getting-started-with-sweave-r-latex.html"&gt;getting-started-with-sweave-r-latex&lt;/a&gt; (3241)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2010/05/abbreviations-of-r-commands-explained.html"&gt;abbreviations-of-r-commands-explained&lt;/a&gt; (2772)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2009/03/calculating-composite-scores-of-ability.html"&gt;calculating-composite-scores-of-ability&lt;/a&gt; (2605)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2009/06/learning-r-for-researchers-in.html"&gt;learning-r-for-researchers-in&lt;/a&gt; (2487)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2009/05/pronunciation-guides-for-mathematical.html"&gt;pronunciation-guides-for-mathematical&lt;/a&gt; (2216)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2010/03/export-from-endnote-to-bibtex-jabref.html"&gt;export-from-endnote-to-bibtex-jabref&lt;/a&gt; (1984)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/search/label/R"&gt;/search/label/R&lt;/a&gt; (1896)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2010/04/winedt-60-for-latex-features.html"&gt;winedt-60-for-latex-features&lt;/a&gt; (1891)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2010/08/getting-started-with-beamer-tips-and.html"&gt;getting-started-with-beamer-tips-and&lt;/a&gt; (1875)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2009/12/multinomial-logistic-regression-spss.html"&gt;multinomial-logistic-regression-spss&lt;/a&gt; (1673)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2009/02/formatting-correlation-matrices-in.html"&gt;formatting-correlation-matrices-in&lt;/a&gt; (1654)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2010/03/texniccenter-customisations.html"&gt;texniccenter-customisations&lt;/a&gt; (1594)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2009/11/generalized-estimating-equations.html"&gt;generalized-estimating-equations&lt;/a&gt; (1537)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2009/10/data-mining-and-r.html"&gt;data-mining-and-r&lt;/a&gt; (1508)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2009/09/structural-equation-modelling-in-r.html"&gt;structural-equation-modelling-in-r&lt;/a&gt; (1456)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2009/03/user-interface-for-r-statet-and-eclipse.html"&gt;user-interface-for-r-statet-and-eclipse&lt;/a&gt; (1445)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2009/05/online-mathematics-video-courses-for.html"&gt;online-mathematics-video-courses-for&lt;/a&gt; (1445)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2009/09/repeated-measures-experiments-with-many.html"&gt;repeated-measures-experiments-with-many&lt;/a&gt; (1385)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2009/10/factor-analysis-in-r.html"&gt;factor-analysis-in-r&lt;/a&gt; (1332)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2009/09/difference-scores-are-they-okay-to-use.html"&gt;difference-scores-are-they-okay-to-use&lt;/a&gt; (1237)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2009/05/statistics-for-psychology-thesis.html"&gt;statistics-for-psychology-thesis&lt;/a&gt; (1156)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2010/02/case-study-in-optimising-code-in-r.html"&gt;case-study-in-optimising-code-in-r&lt;/a&gt; (1127)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2009/12/writing-method-section-in-psychology.html"&gt;writing-method-section-in-psychology&lt;/a&gt; (1115)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2009/12/how-to-write-predictions-and-hypotheses.html"&gt;how-to-write-predictions-and-hypotheses&lt;/a&gt; (1087)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2010/11/sweave-tutorial-using-sweave-r-and-make.html"&gt;sweave-tutorial-using-sweave-r-and-make&lt;/a&gt; (1064)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2009/09/variable-importance-and-multiple.html"&gt;variable-importance-and-multiple&lt;/a&gt; (1063)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2009/10/data-mining-and-statistics-video-course.html"&gt;data-mining-and-statistics-video-course&lt;/a&gt; (1048)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2010/03/running-command-line-programs-in.html"&gt;running-command-line-programs-in&lt;/a&gt; (1010)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2010/06/canonical-correlation-getting-started.html"&gt;canonical-correlation-getting-started&lt;/a&gt; (1006)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2010/05/fitting-nonlinear-regression-models-to.html"&gt;fitting-nonlinear-regression-models-to&lt;/a&gt; (948)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2009/10/analysing-ordinal-variables.html"&gt;analysing-ordinal-variables&lt;/a&gt; (933)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2009/12/practice-questions-for-statistics-in.html"&gt;practice-questions-for-statistics-in&lt;/a&gt; (930)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2010/03/converting-microsoft-word-document-into.html"&gt;converting-microsoft-word-document-into&lt;/a&gt; (922)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2009/10/scoring-multiple-choice-test-in-spss.html"&gt;scoring-multiple-choice-test-in-spss&lt;/a&gt; (901)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2009/10/job-satisfaction-measurement-scales.html"&gt;job-satisfaction-measurement-scales&lt;/a&gt; (864)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2009/09/logistic-regression-resources-in-spss.html"&gt;logistic-regression-resources-in-spss&lt;/a&gt; (859)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2009/09/teaching-resources.html"&gt;teaching-resources&lt;/a&gt; (855)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2009/09/tetrachoric-correlations-overview-and.html"&gt;tetrachoric-correlations-overview-and&lt;/a&gt; (806)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2010/02/analysis-of-winter-olympic-medal-data.html"&gt;analysis-of-winter-olympic-medal-data&lt;/a&gt; (801)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2009/12/structural-equation-modelling-and-path.html"&gt;structural-equation-modelling-and-path&lt;/a&gt; (800)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2009/12/how-to-write-introduction-section-in.html"&gt;how-to-write-introduction-section-in&lt;/a&gt; (789)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2010/04/implications-of-office-layout-and.html"&gt;implications-of-office-layout-and&lt;/a&gt; (788)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2009/09/formatting-table-in-word-r-to-tab.html"&gt;formatting-table-in-word-r-to-tab&lt;/a&gt; (719)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2009/10/calculating-scale-scores-for.html"&gt;calculating-scale-scores-for&lt;/a&gt; (675)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/p/jeromy-anglims-academic-publications.html"&gt;/p/jeromy-anglims-academic-publications&lt;/a&gt; (673)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/p/site-map-jeromy-anglims-blog-psychology.html"&gt;/p/site-map-jeromy-anglims-blog-psychology&lt;/a&gt; (667)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2009/10/exploratory-factor-analysis-and-scale.html"&gt;exploratory-factor-analysis-and-scale&lt;/a&gt; (646)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2010/05/statistical-power-analysis-in-gpower-3.html"&gt;statistical-power-analysis-in-gpower-3&lt;/a&gt; (645)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2010/08/simple-beamer-template-for-getting.html"&gt;simple-beamer-template-for-getting&lt;/a&gt; (645)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2009/09/introduction-to-journal-article.html"&gt;introduction-to-journal-article&lt;/a&gt; (614)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2009/10/introduction-to-spss-syntax-advice-for.html"&gt;introduction-to-spss-syntax-advice-for&lt;/a&gt; (609)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2010/04/how-to-get-quick-access-to-full-text.html"&gt;how-to-get-quick-access-to-full-text&lt;/a&gt; (563)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2010/07/how-to-process-inquisit-raw-data-in.html"&gt;how-to-process-inquisit-raw-data-in&lt;/a&gt; (558)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2009/09/item-parcelling-in-confirmatory-factor.html"&gt;item-parcelling-in-confirmatory-factor&lt;/a&gt; (524)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2009/05/bootstrapping.html"&gt;bootstrapping&lt;/a&gt; (522)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2008/11/carryover-effects-in-repeated-measures.html"&gt;carryover-effects-in-repeated-measures&lt;/a&gt; (513)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2010/12/r-workflow-slides-from-talk-at.html"&gt;r-workflow-slides-from-talk-at&lt;/a&gt; (508)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2010/04/exporting-pdfs-from-jabref-using-batch.html"&gt;exporting-pdfs-from-jabref-using-batch&lt;/a&gt; (494)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2010/11/sweave-tutorial-3-console-input-and.html"&gt;sweave-tutorial-3-console-input-and&lt;/a&gt; (486)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2010/11/sweave-tutorial-2-individual.html"&gt;sweave-tutorial-2-individual&lt;/a&gt; (484)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2010/01/tips-on-reading-mathematics-for-non.html"&gt;tips-on-reading-mathematics-for-non&lt;/a&gt; (476)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2009/10/syntax-tips-for-efficient-variable.html"&gt;syntax-tips-for-efficient-variable&lt;/a&gt; (472)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2009/08/social-network-analysis-resources-for-r.html"&gt;social-network-analysis-resources-for-r&lt;/a&gt; (471)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2010/05/inverting-logistic-function.html"&gt;inverting-logistic-function&lt;/a&gt; (455)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2009/10/scale-construction-item-reversal-scale.html"&gt;scale-construction-item-reversal-scale&lt;/a&gt; (452)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2009/09/significance-tests-on-correlations.html"&gt;significance-tests-on-correlations&lt;/a&gt; (441)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2009/09/discriminant-function-analysis.html"&gt;discriminant-function-analysis&lt;/a&gt; (439)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2009/10/analysis-of-multiple-choice-test.html"&gt;analysis-of-multiple-choice-test&lt;/a&gt; (418)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2009/10/efficient-variable-selection-in-r.html"&gt;efficient-variable-selection-in-r&lt;/a&gt; (414)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2010/04/free-video-courses-on-r-structural.html"&gt;free-video-courses-on-r-structural&lt;/a&gt; (410)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2009/12/meta-analysis-tips-resources-and.html"&gt;meta-analysis-tips-resources-and&lt;/a&gt; (399)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2009/10/practical-tips-on-how-to-conduct_05.html"&gt;practical-tips-on-how-to-conduct_05&lt;/a&gt; (397)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2010/03/choosing-auto-generation-pattern-for.html"&gt;choosing-auto-generation-pattern-for&lt;/a&gt; (389)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2010/11/makefiles-for-sweave-r-and-latex-using.html"&gt;makefiles-for-sweave-r-and-latex-using&lt;/a&gt; (382)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2009/10/tips-for-using-statet-and-eclipse-for.html"&gt;tips-for-using-statet-and-eclipse-for&lt;/a&gt; (372)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2010/01/free-online-mathematics-books.html"&gt;free-online-mathematics-books&lt;/a&gt; (369)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2009/10/follow-up-tests-in-anova-in-spss.html"&gt;follow-up-tests-in-anova-in-spss&lt;/a&gt; (367)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2008/11/causality-and-mediation-analysis.html"&gt;causality-and-mediation-analysis&lt;/a&gt; (357)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2009/02/single-group-correlational-study-basic.html"&gt;single-group-correlational-study-basic&lt;/a&gt; (355)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2010/03/using-regular-expressions-in-r-case.html"&gt;using-regular-expressions-in-r-case&lt;/a&gt; (350)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2010/10/getting-started-with-writing.html"&gt;getting-started-with-writing&lt;/a&gt; (347)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2010/02/clustered-samples-and-assuming.html"&gt;clustered-samples-and-assuming&lt;/a&gt; (339)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2009/09/jeromy-anglims-academic-publications.html"&gt;jeromy-anglims-academic-publications&lt;/a&gt; (338)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2009/09/blogs-on-r-statistics.html"&gt;blogs-on-r-statistics&lt;/a&gt; (334)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2010/11/getting-started-with-git-egit-eclipse.html"&gt;getting-started-with-git-egit-eclipse&lt;/a&gt; (331)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2010/05/34-minute-video-on-using-r-to-analyse.html"&gt;34-minute-video-on-using-r-to-analyse&lt;/a&gt; (328)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2008/11/mediation-and-moderation-reference.html"&gt;mediation-and-moderation-reference&lt;/a&gt; (315)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2009/12/article-deconstruction-how-to-writing.html"&gt;article-deconstruction-how-to-writing&lt;/a&gt; (311)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2009/10/introduction-to-social-network-analysis.html"&gt;introduction-to-social-network-analysis&lt;/a&gt; (304)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2009/12/problems-with-high-resolution-laptops.html"&gt;problems-with-high-resolution-laptops&lt;/a&gt; (280)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2009/03/inquisit-simple-reaction-time-four.html"&gt;inquisit-simple-reaction-time-four&lt;/a&gt; (269)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2009/12/matrix-algebra-in-r-resources-videos.html"&gt;matrix-algebra-in-r-resources-videos&lt;/a&gt; (268)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2010/05/great-measurement-but-small-sample-size.html"&gt;great-measurement-but-small-sample-size&lt;/a&gt; (256)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2009/09/adjusting-correlations-for-reliability.html"&gt;adjusting-correlations-for-reliability&lt;/a&gt; (239)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2009/10/producing-table-of-item-descriptive.html"&gt;producing-table-of-item-descriptive&lt;/a&gt; (236)&lt;/li&gt;
&lt;/ol&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=WIFDu94Km3E:8vi-G4NgyDI:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=WIFDu94Km3E:8vi-G4NgyDI:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=WIFDu94Km3E:8vi-G4NgyDI:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=WIFDu94Km3E:8vi-G4NgyDI:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=WIFDu94Km3E:8vi-G4NgyDI:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=WIFDu94Km3E:8vi-G4NgyDI:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=WIFDu94Km3E:8vi-G4NgyDI:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=WIFDu94Km3E:8vi-G4NgyDI:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=WIFDu94Km3E:8vi-G4NgyDI:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/jeromyanglim/~4/WIFDu94Km3E" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://jeromyanglim.blogspot.com/feeds/509755131525445939/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://jeromyanglim.blogspot.com/2010/12/2010-in-review-99-most-popular-pages-on.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8909074830238091680/posts/default/509755131525445939?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8909074830238091680/posts/default/509755131525445939?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/jeromyanglim/~3/WIFDu94Km3E/2010-in-review-99-most-popular-pages-on.html" title="2010 in Review: 99 Most Popular Pages on Jeromy Anglim's Blog" /><author><name>Jeromy Anglim</name><uri>https://plus.google.com/100803004599943057656</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-xUmT1aa-RI0/AAAAAAAAAAI/AAAAAAAAAvk/eN47FjC3uVU/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://jeromyanglim.blogspot.com/2010/12/2010-in-review-99-most-popular-pages-on.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEYDQHk9cSp7ImA9Wx9QFUw.&quot;"><id>tag:blogger.com,1999:blog-8909074830238091680.post-2319092387814324278</id><published>2010-12-28T17:02:00.000+11:00</published><updated>2010-12-28T17:02:51.769+11:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-12-28T17:02:51.769+11:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="statistics" /><category scheme="http://www.blogger.com/atom/ns#" term="SPSS" /><category scheme="http://www.blogger.com/atom/ns#" term="internet" /><title>Question and Answer Sites on Statistics, Computing, Research, and Psychology</title><content type="html">This post sets out some of my favourite question
 and answer sites on topics related to statistics,
 computing, research, and psychology.  

&lt;a name='more'&gt;&lt;/a&gt;

&lt;h3&gt;Overview&lt;/h3&gt;

&lt;p&gt;Question and answer sites have been a part of the internet
 for a long time.
However, more recent sites such as typified
 by the &lt;a href="http://stackexchange.com/"&gt;StackExchange Model&lt;/a&gt; are 
 improving the situation substantially.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Results are readily searchable on Google.&lt;/li&gt;
&lt;li&gt;Good answers get voted to the top&lt;/li&gt;
&lt;li&gt;Subscriptions are not required&lt;/li&gt;
&lt;li&gt;Incentives are given to posters to provide good answers&lt;/li&gt;
&lt;li&gt;Questions and answers can be edited and improved&lt;/li&gt;
&lt;li&gt;Community and social networks are facilitated&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Forums by Topic&lt;/h3&gt;

&lt;p&gt;The following are some of my current 
favourite question and answer sites for various types of questions.&lt;/p&gt;

&lt;h4&gt;Statistics&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://stats.stackexchange.com/"&gt;Cross Validated&lt;/a&gt;: 
A StackExchange site for questions related to statistics and data analysis.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;R&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://stackoverflow.com/questions/tagged/r"&gt;R Tag on StackOverflow&lt;/a&gt;:
A good option for anything related to programming in R&lt;/li&gt;
&lt;li&gt;&lt;a href="http://stats.stackexchange.com/"&gt;Cross Validated&lt;/a&gt;:
This is a good option if the question concerns statistical elements of R.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://stat.ethz.ch/mailman/listinfo/r-help"&gt;R Help Mailing List&lt;/a&gt;:
Another option for asking R related questions.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;SPSS&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.listserv.uga.edu/archives/spssx-l.html"&gt;SPSSX-L Listserv&lt;/a&gt;:
An SPSS Mailing list&lt;/li&gt;
&lt;li&gt;&lt;a href="http://stats.stackexchange.com/"&gt;Cross Validated&lt;/a&gt;:
Add the SPSS tag to the question.
The question is likely to be better received if it concerns statistics 
more than it concerns SPSS.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;LaTeX&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://tex.stackexchange.com/"&gt;TeX.StackExchange&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Programming&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://stackoverflow.com/"&gt;Stack Overflow&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Inquisit&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.millisecond.com/community/forums/"&gt;Millisecond Forums&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Maths&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://math.stackexchange.com/"&gt;Math Stackexchange&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Computers, Non-programming&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="
http://superuser.com/"&gt;SuperUser&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;General Question and Answer Sites&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.quora.com"&gt;Quora&lt;/a&gt;:
Quora is relatively new and is designed to cover any
question imaginable.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Psychological Research&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="
http://area51.stackexchange.com/proposals/2149/cognitive-science?referrer=-MJssSabI9MN5QfMOt5KEg2"&gt;A Cognitive Science StackExchange&lt;/a&gt;
has been proposed.
If this interests you, commit to the proposal.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Additional Resources&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="
http://www.catb.org/~esr/faqs/smart-questions.html"&gt;How to ask questions the smart way&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=HOkSyESN5xU:3YBh3ajblU0:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=HOkSyESN5xU:3YBh3ajblU0:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=HOkSyESN5xU:3YBh3ajblU0:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=HOkSyESN5xU:3YBh3ajblU0:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=HOkSyESN5xU:3YBh3ajblU0:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=HOkSyESN5xU:3YBh3ajblU0:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=HOkSyESN5xU:3YBh3ajblU0:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=HOkSyESN5xU:3YBh3ajblU0:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=HOkSyESN5xU:3YBh3ajblU0:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/jeromyanglim/~4/HOkSyESN5xU" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://jeromyanglim.blogspot.com/feeds/2319092387814324278/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://jeromyanglim.blogspot.com/2010/12/question-and-answer-sites-on-statistics.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8909074830238091680/posts/default/2319092387814324278?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8909074830238091680/posts/default/2319092387814324278?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/jeromyanglim/~3/HOkSyESN5xU/question-and-answer-sites-on-statistics.html" title="Question and Answer Sites on Statistics, Computing, Research, and Psychology" /><author><name>Jeromy Anglim</name><uri>https://plus.google.com/100803004599943057656</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-xUmT1aa-RI0/AAAAAAAAAAI/AAAAAAAAAvk/eN47FjC3uVU/s512-c/photo.jpg" /></author><thr:total>2</thr:total><feedburner:origLink>http://jeromyanglim.blogspot.com/2010/12/question-and-answer-sites-on-statistics.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkEHRXY6fip7ImA9WhBUEEg.&quot;"><id>tag:blogger.com,1999:blog-8909074830238091680.post-3721897032784687047</id><published>2010-12-13T23:40:00.002+11:00</published><updated>2013-04-27T18:17:14.816+10:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-04-27T18:17:14.816+10:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="version_control" /><category scheme="http://www.blogger.com/atom/ns#" term="LaTeX" /><category scheme="http://www.blogger.com/atom/ns#" term="Sweave" /><category scheme="http://www.blogger.com/atom/ns#" term="make" /><category scheme="http://www.blogger.com/atom/ns#" term="R" /><category scheme="http://www.blogger.com/atom/ns#" term="Australia" /><title>Video of Reproducible Research with R: Melbourne R Users 1st Dec 2010</title><content type="html">&lt;p&gt;As &lt;a href="http://jeromyanglim.blogspot.com/2010/12/r-workflow-slides-from-talk-at.html"&gt;previously
mentioned&lt;/a&gt;
I gave a talk at Melbourne R Users Group titled "Reproducible Research
and R Workflow". It covered technologies including LaTeX, Sweave, R,
make, Eclipse, and git. This post shares the video. &lt;a name='more'&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I'd like to thank Pedro Olaya for filming the session, and &lt;a href="http://www.drewconway.com/zia/"&gt;Drew
Conway&lt;/a&gt; for preparing, uploading, and
hosting the video along with the many other &lt;a href="http://www.vcasmo.com/user/drewconway"&gt;great existing videos from
R User Groups from around the
world&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you follow Drew's Blog &lt;a href="http://www.drewconway.com/zia/"&gt;ZIA&lt;/a&gt; you
may have already seen the video. If you don't follow his blog, you
should definitely check it out. Here are three of my favourite posts by
Drew:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.drewconway.com/zia/?p=2378"&gt;Data Science Venn Diagram&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://blog.yhathq.com/posts/10-R-packages-I-wish-I-knew-about-earlier.html"&gt;Must have R Packages for Social
Scientists&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://drewconway.com/zia/2013/3/27/ten-reasons-why-grad-students-should-blog"&gt;Ten Reasons Why Grad Students Should
Blog&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;For those who did not catch Drew's &lt;a href="http://www.drewconway.com/zia/?p=2549"&gt;original
post&lt;/a&gt;, the videos are shown
below.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt; The videos were taken down so I've replaced them with YouTube version.&lt;/p&gt;

&lt;h3&gt;My Talk&lt;/h3&gt;

&lt;p&gt;For a copy of the slides, R Code, and more see the &lt;a href="http://jeromyanglim.blogspot.com/2010/12/r-workflow-slides-from-talk-at.html"&gt;previous
post&lt;/a&gt;.
The video is embedded below (If you are viewing this post in a feed
reader, and the embedded video is not displaying &lt;a href="http://jeromyanglim.blogspot.com/2010/12/video-of-reproducible-research-with-r.html"&gt;click
here&lt;/a&gt;
to go to the original post):&lt;/p&gt;

&lt;iframe width="560" height="315" src="http://www.youtube.com/embed/bbaPSJechgY?list=PL2E4B515A6ED513B0" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;


&lt;h3&gt;Geoff's Talk&lt;/h3&gt;

&lt;p&gt;The other talk from the session was by Geoff Robinson who discussed
several useful strategies for working with R.&lt;/p&gt;

&lt;p&gt;The
&lt;a href="http://files.meetup.com/1685538/R%20Workflow%20slides%20Geoff%20Robinson.ppt"&gt;slides&lt;/a&gt;
and &lt;a href="http://files.meetup.com/1685538/R%20Workflow%20script%20Geoff%20Robinson.R"&gt;R
Script&lt;/a&gt;
are available for download.&lt;/p&gt;

&lt;p&gt;The talk is embedded below:&lt;/p&gt;

&lt;iframe width="560" height="315" src="http://www.youtube.com/embed/DK1pdGhYRa8?list=PL2E4B515A6ED513B0" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;


&lt;h3&gt;Melbourne R User Group&lt;/h3&gt;

&lt;p&gt;&lt;a href="http://www.meetup.com/MelbURN-Melbourne-Users-of-R-Network/members/12349115/"&gt;Yuval
Marom&lt;/a&gt;
kindly asked me to become a co-organiser of the &lt;a href="http://www.meetup.com/MelbURN-Melbourne-Users-of-R-Network/"&gt;Melbourne R user Group
(MelbURN)&lt;/a&gt;.
While most people who read this blog are from overseas, if you are in
Melbourne, feel free to &lt;a href="http://www.meetup.com/MelbURN-Melbourne-Users-of-R-Network/"&gt;join the
group&lt;/a&gt;.
If you know something about R, are passing through Melbourne, and would
like to give a talk on R, let Yuval or me know (see the &lt;a href="%20http://www.meetup.com/MelbURN-Melbourne-Users-of-R-Network/"&gt;Contact Us
Button&lt;/a&gt;),
and we'll see if we can organise something.&lt;/p&gt;

&lt;h3&gt;Related Resources&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2010/05/videos-on-data-analysis-with-r.html"&gt;R
Videos&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/search/label/Sweave"&gt;R and
Sweave&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/jeromyanglim"&gt;Code from the talk on jeromyanglim @
github&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=ZPh9DNB8u_I:i451v87wwrY:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=ZPh9DNB8u_I:i451v87wwrY:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=ZPh9DNB8u_I:i451v87wwrY:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=ZPh9DNB8u_I:i451v87wwrY:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=ZPh9DNB8u_I:i451v87wwrY:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=ZPh9DNB8u_I:i451v87wwrY:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=ZPh9DNB8u_I:i451v87wwrY:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=ZPh9DNB8u_I:i451v87wwrY:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=ZPh9DNB8u_I:i451v87wwrY:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/jeromyanglim/~4/ZPh9DNB8u_I" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://jeromyanglim.blogspot.com/feeds/3721897032784687047/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://jeromyanglim.blogspot.com/2010/12/video-of-reproducible-research-with-r.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8909074830238091680/posts/default/3721897032784687047?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8909074830238091680/posts/default/3721897032784687047?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/jeromyanglim/~3/ZPh9DNB8u_I/video-of-reproducible-research-with-r.html" title="Video of Reproducible Research with R: Melbourne R Users 1st Dec 2010" /><author><name>Jeromy Anglim</name><uri>https://plus.google.com/100803004599943057656</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-xUmT1aa-RI0/AAAAAAAAAAI/AAAAAAAAAvk/eN47FjC3uVU/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://img.youtube.com/vi/bbaPSJechgY/default.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://jeromyanglim.blogspot.com/2010/12/video-of-reproducible-research-with-r.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkIMQXg5fip7ImA9Wx9SEk0.&quot;"><id>tag:blogger.com,1999:blog-8909074830238091680.post-2454464486960253630</id><published>2010-12-02T00:03:00.000+11:00</published><updated>2010-12-02T00:03:00.626+11:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-12-02T00:03:00.626+11:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="presentations" /><category scheme="http://www.blogger.com/atom/ns#" term="version_control" /><category scheme="http://www.blogger.com/atom/ns#" term="LaTeX" /><category scheme="http://www.blogger.com/atom/ns#" term="Sweave" /><category scheme="http://www.blogger.com/atom/ns#" term="make" /><category scheme="http://www.blogger.com/atom/ns#" term="R" /><title>R Workflow: Slides from a Talk at Melbourne R Users (1st Dec 2010)</title><content type="html">I gave a presentation at 
&lt;a href="
http://www.meetup.com/MelbURN-Melbourne-Users-of-R-Network/"&gt;Melbourne R Users&lt;/a&gt;
on the topic of R Workflow.
The presentation covered R code organisation,
and useful R related tools including Eclipse, StatET, Git, make, Sweave
and LaTeX.
Also, the slides from the presentation
 provide links to four complete examples of using R, 
 Sweave, LaTeX, and make.

&lt;a name='more'&gt;&lt;/a&gt;

&lt;h3&gt;PDF of Slides&lt;/h3&gt;

&lt;p&gt;A PDF of the slides
 is available in &lt;a href="
 https://github.com/jeromyanglim/RMeetup_Workflow/raw/master/backup/Rmeetup_Workflow_fullscreen.pdf"&gt;fullscreen&lt;/a&gt;
 and &lt;a href="
https://github.com/jeromyanglim/RMeetup_Workflow/raw/master/backup/Rmeetup_Workflow_handout.pdf"&gt;four-to-a-page handout&lt;/a&gt;
format.
Most slides contain links to resources for learning more.
Thus, it should be possible to understand the main ideas of the talk just 
by just reading the slides and reading the links.&lt;/p&gt;

&lt;h3&gt;Video&lt;/h3&gt;

&lt;p&gt;A video of both my talk and the previous talk
by Geoff Robinson will hopefully be made available in the not
too distant future (I'll post when it is available).&lt;/p&gt;

&lt;h3&gt;Github Repository&lt;/h3&gt;

&lt;p&gt;If you want to learn more about &lt;code&gt;beamer&lt;/code&gt;, &lt;code&gt;LaTeX&lt;/code&gt; and &lt;code&gt;make&lt;/code&gt;,
you can check out the source code used to produce the PDF of the presentation.
The repository is available on GitHub:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/jeromyanglim/RMeetup_Workflow"&gt;https://github.com/jeromyanglim/RMeetup_Workflow&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Thanks&lt;/h3&gt;

&lt;p&gt;I'd like to thank &lt;a href="http://www.meetup.com/MelbURN-Melbourne-Users-of-R-Network/members/12349115/"&gt;Yuval Marom&lt;/a&gt;
 for all the work he has put into
kickstarting and organising the &lt;a href="
http://www.meetup.com/MelbURN-Melbourne-Users-of-R-Network/"&gt;Melbourne R User Group&lt;/a&gt;
and Deloitte for providing such a great venue.&lt;/p&gt;

&lt;h3&gt;Links Presented in the Talk&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="
http://blog.revolutionanalytics.com/2010/10/a-workflow-for-r.html"&gt;David Smith on R Workflow&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="
http://stackoverflow.com/questions/1429907/workflow-for-statistical-analysis-and-report-writing/1434424"&gt;StackOverflow Question on R Workflow&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="
http://www.johnmyleswhite.com/notebook/2010/08/26/projecttemplate/"&gt;John Myles White's ProjectTemplate&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="
http://www.walware.de/goto/statet"&gt;StatET Official Site&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="
http://www.splusbook.com/RIntro/RCourseMaterial.html"&gt;Useful StatET Documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="
http://jeromyanglim.blogspot.com/2010/02/getting-started-with-sweave-r-latex.html"&gt;My Guide to Getting Started with Eclipse, StatET and Sweave&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="
http://jeromyanglim.blogspot.com/2010/11/getting-started-with-git-egit-eclipse.html"&gt;Git, Egit, and Eclipse&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="
http://jeromyanglim.blogspot.com/2010/11/makefiles-for-sweave-r-and-latex-using.html"&gt;Makefiles, Sweave, and R&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="
http://jeromyanglim.blogspot.com/2010/11/sweave-tutorial-using-sweave-r-and-make.html"&gt;Sweave Tutorial 1&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="
http://jeromyanglim.blogspot.com/2010/11/sweave-tutorial-2-individual.html"&gt;Sweave Tutorial 2&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="
http://jeromyanglim.blogspot.com/2010/11/sweave-tutorial-3-console-input-and.html"&gt;Sweave Tutorial 3&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="
https://github.com/jeromyanglim/Sweave_Winter_Olympics"&gt;GitHub Repository of what will be Sweave Tutorial 4&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=ad_KA4tXlGw:K9VV4N2OIdA:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=ad_KA4tXlGw:K9VV4N2OIdA:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=ad_KA4tXlGw:K9VV4N2OIdA:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=ad_KA4tXlGw:K9VV4N2OIdA:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=ad_KA4tXlGw:K9VV4N2OIdA:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=ad_KA4tXlGw:K9VV4N2OIdA:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=ad_KA4tXlGw:K9VV4N2OIdA:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=ad_KA4tXlGw:K9VV4N2OIdA:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=ad_KA4tXlGw:K9VV4N2OIdA:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/jeromyanglim/~4/ad_KA4tXlGw" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://jeromyanglim.blogspot.com/feeds/2454464486960253630/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://jeromyanglim.blogspot.com/2010/12/r-workflow-slides-from-talk-at.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8909074830238091680/posts/default/2454464486960253630?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8909074830238091680/posts/default/2454464486960253630?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/jeromyanglim/~3/ad_KA4tXlGw/r-workflow-slides-from-talk-at.html" title="R Workflow: Slides from a Talk at Melbourne R Users (1st Dec 2010)" /><author><name>Jeromy Anglim</name><uri>https://plus.google.com/100803004599943057656</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-xUmT1aa-RI0/AAAAAAAAAAI/AAAAAAAAAvk/eN47FjC3uVU/s512-c/photo.jpg" /></author><thr:total>1</thr:total><feedburner:origLink>http://jeromyanglim.blogspot.com/2010/12/r-workflow-slides-from-talk-at.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEUHRHYyeip7ImA9Wx9SEUw.&quot;"><id>tag:blogger.com,1999:blog-8909074830238091680.post-5212348335923420306</id><published>2010-11-30T22:23:00.000+11:00</published><updated>2010-11-30T22:23:55.892+11:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-11-30T22:23:55.892+11:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="LaTeX" /><category scheme="http://www.blogger.com/atom/ns#" term="Sweave" /><category scheme="http://www.blogger.com/atom/ns#" term="R" /><title>Sweave Tutorial 3: Console Input and Output - Multiple Choice Test Analysis</title><content type="html">This post provides an example of using Sweave
 to perform an item analysis of a multiple choice test.
It is designed as a tutorial for learning more about 
 using Sweave in a mode where console input and output is displayed.
Copies of all source code and the final PDF report is provided.

&lt;a name='more'&gt;&lt;/a&gt;

&lt;h3&gt;Overview&lt;/h3&gt;

&lt;p&gt;The repository with all source files is available at:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/jeromyanglim/Sweave_Item_Analysis/"&gt;https://github.com/jeromyanglim/Sweave_Item_Analysis/&lt;/a&gt;.&lt;!--_--&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A copy of the resulting PDF can be viewed &lt;a href="
https://github.com/jeromyanglim/Sweave_Item_Analysis/raw/master/.backup/Item_Analysis_Report.pdf"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;For general information on program requirements and running the code
 see &lt;a href="
 http://jeromyanglim.blogspot.com/2010/11/sweave-tutorial-using-sweave-r-and-make.html"&gt;this earlier post&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;Sweave Documents that Display Console Input and Output&lt;/h3&gt;

&lt;p&gt;I find it useful to distinguish between different kinds of 
Sweave documents. One key distinction is between &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;reports that display the console and reports 
that do no display the console.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Reports that display the console are suited to distinct applications,
 including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;R tutorials&lt;/li&gt;
&lt;li&gt;Personal analyses&lt;/li&gt;
&lt;li&gt;Analyses provided to experts who understand R and the Project&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It would be further possible to distinguish between 
reports that do and do not show the console input (&lt;code&gt;echo=true&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;Developing Sweave reports that display the console
still benefit from thoughtful variable names, 
selective display of output and so forth.
However, naturally less time is invested in 
putting the polish on figures, tables, and inline text.&lt;/p&gt;

&lt;p&gt;The previous Sweave Tutorials were examples
 of Sweave documents that do not display the console.
&lt;a href="
http://jeromyanglim.blogspot.com/2010/11/sweave-tutorial-using-sweave-r-and-make.html"&gt;Tutorial 1 was a data driven document&lt;/a&gt;
&lt;a href="
http://jeromyanglim.blogspot.com/2010/11/sweave-tutorial-2-individual.html"&gt;Tutorial 2 was a set of batch polished reports&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The present tutorial is an example of
a Sweave document that displays console input and output.&lt;/p&gt;

&lt;p&gt;The remainder of the post discusses various aspects of the 
 source code.&lt;/p&gt;

&lt;h3&gt;Source Code&lt;/h3&gt;

&lt;h3&gt;Folder and File Structure&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;.gitignore&lt;/code&gt; records the folder where derived files are stored by &lt;code&gt;make&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;makefile&lt;/code&gt; is similar to that explained and used in &lt;a href="
http://jeromyanglim.blogspot.com/2010/11/sweave-tutorial-using-sweave-r-and-make.html"&gt;Sweave Tutorial 1&lt;/a&gt;.
This similarity has been obtained through 
(a) the use of variables in the &lt;code&gt;makefile&lt;/code&gt; 
(b) the fact that both projects are driven by the &lt;code&gt;Rnw&lt;/code&gt; file;
thus, make calls Rnw, which in turn imports data, and so forth.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;README.md&lt;/code&gt; is a file in &lt;a href="
http://jeromyanglim.blogspot.com/2010/11/getting-started-with-markdown-benefits.html"&gt;markdown&lt;/a&gt;.
Markdown is the markup language used on Github.
The file is automatically displayed on the repository home page.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;data&lt;/code&gt;: This folder contains a file with the responses to the 50
multiple choice questions.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;meta&lt;/code&gt;: This folder contains a file with information
about each of the 50 multiple choice questions including the text,
response options, and the supposedly correct response.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;backup&lt;/code&gt;: This folder contains a copy of the resulting PDF.
Although this is a derived file and as such should not generally be monitored
by Git, it's helpful to include a copy for easy access.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Sweave.sty&lt;/code&gt;: I find it easier and more portable to just include this
LaTeX style file required by Sweave in with the project.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Item_Analysis_Report.Rnw&lt;/h3&gt;

&lt;h4&gt;Library loading and data import&lt;/h4&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;&amp;lt;initial_settings, echo=false&amp;gt;&amp;gt;=
options(stringsAsFactors=FALSE)
options(width=80)
library(psych) # used scoring and alpha
library(CTT) # used for spearman brown prophecy
@


&amp;lt;&amp;lt;import_data, echo=false&amp;gt;&amp;gt;=
cases &amp;lt;- read.delim("data/cases.tsv")
items &amp;lt;- read.delim("meta/items.tsv")
items$variable &amp;lt;- paste("item", items$item, sep="")
@
&lt;/code&gt;&lt;/pre&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;options(width=80)&lt;/code&gt; ensures that the console width is suitable
for the printed page&lt;/li&gt;
&lt;li&gt;&lt;code&gt;options(stringsAsFactors=FALSE)&lt;/code&gt; means that character variables
imported using &lt;code&gt;read.delim&lt;/code&gt; are left as character variables 
and not converted into &lt;code&gt;factors&lt;/code&gt;.
In general I find this a more useful default behaviour.
In particular I often use the actual text, particularly in metadata, 
to generate variable names, print text and so forth.
Leaving variables as character is better for this.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Using data before it has apparently been generated&lt;/h4&gt;

&lt;pre&gt;&lt;code&gt;...
The example involves performing an item analysis of 
responses of \Sexpr{nrow(cases)} students 
to a set of \Sexpr{nrow(items)} multiple choice test items.
...

&amp;lt;&amp;lt;&amp;gt;&amp;gt;=
&amp;lt;&amp;lt;initial_settings&amp;gt;&amp;gt;
&amp;lt;&amp;lt;import_data&amp;gt;&amp;gt;
@
&lt;/code&gt;&lt;/pre&gt;

&lt;ul&gt;
&lt;li&gt;In the above code I wanted to be able to write the number
of cases before showing the code for importing settings and data.
Thus, I first ran the code chunks with &lt;code&gt;echo=false&lt;/code&gt; to prevent display.
Then, afterwards, these code chunks were rerun inside a code chunk
using the syntax &lt;code&gt;&amp;lt;&amp;lt;name_of_code_chunk&amp;gt;&amp;gt;&lt;/code&gt; &lt;!--_--&gt;
(i.e., without the &lt;code&gt;=&lt;/code&gt; sign at the end of the opening.
This time they were displayed.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Scoring multiple choice tests&lt;/h4&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;&amp;lt;score_test&amp;gt;&amp;gt;=
itemstats &amp;lt;- score.multiple.choice(key = items$correct, 
            data = cases[,items$variable])
@
&lt;/code&gt;&lt;/pre&gt;

&lt;!--_--&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;score.multiple.choice&lt;/code&gt; is a function in the &lt;code&gt;psych&lt;/code&gt; package
for scoring multiple choice tests.
&lt;code&gt;key&lt;/code&gt; is a vector of integers representing the correct response.
&lt;code&gt;data&lt;/code&gt; is a matrix or data.frame of responses from a 
set of respondents.&lt;/li&gt;
&lt;li&gt;the example shows how metadata can be used to simplify code.
&lt;code&gt;items$variable&lt;/code&gt; includes the name of the 50 personality test items
&lt;code&gt;items$correct&lt;/code&gt; includes the vector of correct responses.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;...&lt;/p&gt;

&lt;h3&gt;Figures in Sweave&lt;/h3&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;&amp;lt;plot_mean_by_r, fig=true&amp;gt;&amp;gt;=
plot(r ~ mean , itemstats$item.stats, type="n")
text(itemstats$item.stats$mean, itemstats$item.stats$r, 1:50)
abline(h=.2, v=c(.5, .9))
@
&lt;/code&gt;&lt;/pre&gt;

&lt;ul&gt;
&lt;li&gt;Code chunks can produce single figures.
the &lt;code&gt;fig=true&lt;/code&gt; key-value pair is required.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;type="n"&lt;/code&gt; is used to not show points
and then &lt;code&gt;text(...)&lt;/code&gt; is used to plot the item numbers on the plot.&lt;/li&gt;
&lt;li&gt;Because the document is an informal document
designed to display the console,
the figure is not wrapped in a figure float.
A float would involve more typing and might even be annoying if
it moved around the document.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;...&lt;/p&gt;

&lt;h3&gt;Using Sweave to Better follow the DRY (Don't Repeat Yourself) Principle&lt;/h3&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;&amp;lt;flag_bad_items&amp;gt;&amp;gt;=
rules &amp;lt;- list(
        tooEasy = .95,
        tooHard = .3,
        lowR = .15)
oritemstats$item.stats$tooEasy &amp;lt;- 
    oritemstats$item.stats$mean &amp;gt; rules$tooEasy
...
@

\begin{itemize}
\item \emph{Too Easy}: mean correct $&amp;gt;$
\Sexpr{rules$tooEasy}.
\Sexpr{sum(oritemstats$item.stats$tooEasy)}
items were bad by this definition.
... 
\end{itemize}
&lt;/code&gt;&lt;/pre&gt;

&lt;ul&gt;
&lt;li&gt;The above abbreviated version of the actual code highlights 
how Sweave can be used to prevent repetition
and facilitate modifiability.&lt;/li&gt;
&lt;li&gt;The code flags items as too easy if more than 95% of participants
get the item correct.
This value (&lt;code&gt;.95&lt;/code&gt;) is stored in a variable.
It's then subsequently used both in the code to flag
items as too easy and also used in the text where the
rule is described in plain text (i.e., &lt;code&gt;\Sexpr{rules$tooEasy}&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;This is a particularly powerful use of Sweave whereby any text
in a document that might be repeated or any text that describes
details of a data analytic algorithm is a good candidate for simplification
using Sweave.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;...&lt;/p&gt;

&lt;h4&gt;\Sexpr{} and formatting&lt;/h4&gt;

&lt;pre&gt;&lt;code&gt;The formula suggests  that in order to obtain
an alpha of \Sexpr{sbrown$targetAlpha},
\Sexpr{round(sbrown$multiple, 2)} times as many items are required.
Thus, the final scale would need around
\Sexpr{ceiling(sbrown$refinedItemCount)} items.
Assuming a similar number of good and bad items,
this would require an initial pool of around
\Sexpr{ceiling(sbrown$totalItemCount)} items.
&lt;/code&gt;&lt;/pre&gt;

&lt;ul&gt;
&lt;li&gt;The above code highlights a couple of examples of how inline
formatting of numbers can be done, and is often required
when including inline text.
In this case, &lt;code&gt;ceiling&lt;/code&gt; and &lt;code&gt;round&lt;/code&gt; functions were used.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Sweave Tutorial Series&lt;/h3&gt;

&lt;p&gt;This post is the third installment in a Sweave Tutorial Series:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="
http://jeromyanglim.blogspot.com/2010/11/sweave-tutorial-using-sweave-r-and-make.html"&gt;Using Sweave, R, and Make to Generate a PDF of Multiple Choice Questions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="
http://jeromyanglim.blogspot.com/2010/11/sweave-tutorial-using-sweave-r-and-make.html"&gt;Batch Individual Personality Reports using R, Sweave, and LaTeX&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;Related Posts&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2010/02/getting-started-with-sweave-r-latex.html"&gt;Getting Started with Sweave&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jeromyanglim.blogspot.com/2010/02/getting-started-with-sweave-r-latex.html"&gt;makefiles for Sweave, R and LaTeX using Eclipse on Windows&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=R7Lia5VFUKE:PQlEuUOcRsk:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=R7Lia5VFUKE:PQlEuUOcRsk:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=R7Lia5VFUKE:PQlEuUOcRsk:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=R7Lia5VFUKE:PQlEuUOcRsk:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=R7Lia5VFUKE:PQlEuUOcRsk:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=R7Lia5VFUKE:PQlEuUOcRsk:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=R7Lia5VFUKE:PQlEuUOcRsk:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?i=R7Lia5VFUKE:PQlEuUOcRsk:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/jeromyanglim?a=R7Lia5VFUKE:PQlEuUOcRsk:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeromyanglim?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/jeromyanglim/~4/R7Lia5VFUKE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://jeromyanglim.blogspot.com/feeds/5212348335923420306/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://jeromyanglim.blogspot.com/2010/11/sweave-tutorial-3-console-input-and.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8909074830238091680/posts/default/5212348335923420306?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8909074830238091680/posts/default/5212348335923420306?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/jeromyanglim/~3/R7Lia5VFUKE/sweave-tutorial-3-console-input-and.html" title="Sweave Tutorial 3: Console Input and Output - Multiple Choice Test Analysis" /><author><name>Jeromy Anglim</name><uri>https://plus.google.com/100803004599943057656</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-xUmT1aa-RI0/AAAAAAAAAAI/AAAAAAAAAvk/eN47FjC3uVU/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://jeromyanglim.blogspot.com/2010/11/sweave-tutorial-3-console-input-and.html</feedburner:origLink></entry></feed>
