<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>R-bloggers</title>
	<atom:link href="http://www.r-bloggers.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.r-bloggers.com</link>
	<description>R news and tutorials contributed by (452) R bloggers</description>
	<lastBuildDate>Wed, 19 Jun 2013 18:26:43 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>R Plotting Financial Time Series</title>
		<link>http://www.r-bloggers.com/r-plotting-financial-time-series/</link>
		<comments>http://www.r-bloggers.com/r-plotting-financial-time-series/#comments</comments>
		<pubDate>Wed, 19 Jun 2013 15:45:00 +0000</pubDate>
		<dc:creator>klr</dc:creator>
				<category><![CDATA[R bloggers]]></category>

		<guid isPermaLink="false">http://www.r-bloggers.com/?guid=e0bd042e5c6e32fc4d5dd2703fcd7474</guid>
		<description><![CDATA[In my little world of finance, data almost always is a time series.&#160; Through both quiet iteration and significant revolutions, the volunteers of R have made analyzing and charting time series pleasant.&#160; As a mini-tribute to all those who have...]]></description>
				<content:encoded><![CDATA[<p class="syndicated-attribution"><div class="social4i" style="height:29px;"><div class="social4in" style="height:29px;float: left;"><div class="socialicons s4fblike" style="float:left;margin-right: 10px;"><div id="fb-root"></div><div class="fb-like" data-href="http://www.r-bloggers.com/r-plotting-financial-time-series/" data-send="true"  data-layout="button_count" data-width="100" data-height="21"  data-show-faces="false"></div></div><div class="socialicons s4twitter" style="float:left;margin-right: 10px;"><a href="https://twitter.com/share" data-url="http://www.r-bloggers.com/r-plotting-financial-time-series/" data-counturl="http://www.r-bloggers.com/r-plotting-financial-time-series/" data-text="R Plotting Financial Time Series" class="twitter-share-button" data-count="horizontal" data-via="rbloggers"></a></div><div class="socialicons s4plusone" style="float:left;margin-right: 10px;"><g:plusone size="medium" href="http://www.r-bloggers.com/r-plotting-financial-time-series/" count="true"></g:plusone></div></div><div style="clear:both"></div></div>

<div style="border: 1px solid; background: none repeat scroll 0 0 #EDEDED; margin: 1px; font-size: 12px;">
(This article was first published on  <strong><a href="http://timelyportfolio.blogspot.com/2013/06/r-plotting-financial-time-series.html"> Timely Portfolio</a></strong>, and kindly contributed to <a href="http://www.r-bloggers.com/" rel="nofollow">R-bloggers)</a>      
</div></p>
<p>In my little world of finance, data almost always is a time series.&nbsp; Through both quiet iteration and significant revolutions, the volunteers of R have made analyzing and charting time series pleasant.&nbsp; As a mini-tribute to all those who have helped, I wanted to write a short history of R time series plotting, specifically focusing on financial time series.&nbsp; I have embedded below, but it will look much better if you go to <a href="http://timelyportfolio.github.io/rCharts_time_series/history.html" ref="nofollow" target="_blank">Github pages version</a>.</p><iframe src="http://timelyportfolio.github.io/rCharts_time_series/history.html" height="600px" width="720px"></iframe>  
<p class="syndicated-attribution"><div class="social4i" style="height:82px;"><div class="social4in" style="height:82px;float: left;"><div class="socialicons s4fblike" style="float:left;margin-right: 10px;"><div id="fb-root"></div><div class="fb-like" data-href="http://www.r-bloggers.com/r-plotting-financial-time-series/" data-send="true"  data-layout="box_count" data-width="55" data-height="62"  data-show-faces="false"></div></div><div class="socialicons s4twitter" style="float:left;margin-right: 10px;"><a href="https://twitter.com/share" data-url="http://www.r-bloggers.com/r-plotting-financial-time-series/" data-counturl="http://www.r-bloggers.com/r-plotting-financial-time-series/" data-text="R Plotting Financial Time Series" class="twitter-share-button" data-count="vertical" data-via="rbloggers"></a></div><div class="socialicons s4plusone" style="float:left;margin-right: 10px;"><g:plusone size="tall" href="http://www.r-bloggers.com/r-plotting-financial-time-series/" count="true"></g:plusone></div></div><div style="clear:both"></div></div>

<div style="border: 1px solid; background: none repeat scroll 0 0 #EDEDED; margin: 1px; font-size: 13px;">
<div style="text-align: center;">To <strong>leave a comment</strong> for the author, please follow the link and comment on his blog: <strong><a href="http://timelyportfolio.blogspot.com/2013/06/r-plotting-financial-time-series.html"> Timely Portfolio</a></strong>.</div>
<hr />
<a href="http://www.r-bloggers.com/" rel="nofollow">R-bloggers.com</a> offers <strong><a href="http://feedburner.google.com/fb/a/mailverify?uri=RBloggers" rel="nofollow">daily e-mail updates</a></strong> about <a title="The R Project for Statistical Computing" href="http://www.r-project.org/" rel="nofollow">R</a> news and <a title="R tutorials" href="http://www.r-bloggers.com/?s=tutorial" rel="nofollow">tutorials</a> on topics such as: visualization (<a title="ggplot and ggplot2 tutorials" href="http://www.r-bloggers.com/?s=ggplot2" rel="nofollow">ggplot2</a>, <a title="Boxplots using lattice and ggplot2 tutorials" href="http://www.r-bloggers.com/?s=boxplot" rel="nofollow">Boxplots</a>, <a title="Maps and gis" href="http://www.r-bloggers.com/?s=map" rel="nofollow">maps</a>, <a title="Animation in R" href="http://www.r-bloggers.com/?s=animation" rel="nofollow">animation</a>), programming (<a title="RStudio IDE for R" href="http://www.r-bloggers.com/?s=RStudio" rel="nofollow">RStudio</a>, <a title="Sweave and literate programming" href="http://www.r-bloggers.com/?s=sweave" rel="nofollow">Sweave</a>, <a title="LaTeX in R" href="http://www.r-bloggers.com/?s=LaTeX" rel="nofollow">LaTeX</a>, <a title="SQL and databases" href="http://www.r-bloggers.com/?s=SQL" rel="nofollow">SQL</a>, <a title="Eclipse IDE for R" href="http://www.r-bloggers.com/?s=eclipse" rel="nofollow">Eclipse</a>, <a title="git and github, Version Control System" href="http://www.r-bloggers.com/?s=git" rel="nofollow">git</a>, <a title="Large data in R using Hadoop" href="http://www.r-bloggers.com/?s=hadoop" rel="nofollow">hadoop</a>, <a title="Web Scraping of google, facebook, yahoo, twitter and more using R" href="http://www.r-bloggers.com/?s=Web+Scraping" rel="nofollow">Web Scraping</a>) statistics (<a title="Regressions and ANOVA analysis tutorials" href="http://www.r-bloggers.com/?s=regression" rel="nofollow">regression</a>, <a title="principal component analysis tutorial" href="http://www.r-bloggers.com/?s=PCA" rel="nofollow">PCA</a>, <a title="Time series" href="http://www.r-bloggers.com/?s=time+series" rel="nofollow">time series</a>, <a title="finance trading" href="http://www.r-bloggers.com/?s=trading" rel="nofollow">trading</a>) and more...
</div></p>]]></content:encoded>
			<wfw:commentRss>http://www.r-bloggers.com/r-plotting-financial-time-series/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="" length="" type="" />
		</item>
		<item>
		<title>highlight 0.4.2</title>
		<link>http://www.r-bloggers.com/highlight-0-4-2/</link>
		<comments>http://www.r-bloggers.com/highlight-0-4-2/#comments</comments>
		<pubDate>Wed, 19 Jun 2013 10:33:21 +0000</pubDate>
		<dc:creator>romain</dc:creator>
				<category><![CDATA[R bloggers]]></category>

		<guid isPermaLink="false">http://blog.r-enthusiasts.com/?p=110</guid>
		<description><![CDATA[highlight 0.4.2 is on CRAN. This fixes a few bugs reported by users. The main improvement is that we can now use highlight as a vignette engine, using the functionality introduced in R 3.0.0. In the Rcpp universe, we use &#8230; <a href="http://blog.r-enthusiasts.com/2013/06/19/highlight-0-4-2/">Continue reading <span>&#8594;</span></a>
]]></description>
				<content:encoded><![CDATA[<p class="syndicated-attribution"><div class="social4i" style="height:29px;"><div class="social4in" style="height:29px;float: left;"><div class="socialicons s4fblike" style="float:left;margin-right: 10px;"><div id="fb-root"></div><div class="fb-like" data-href="http://www.r-bloggers.com/highlight-0-4-2/" data-send="true"  data-layout="button_count" data-width="100" data-height="21"  data-show-faces="false"></div></div><div class="socialicons s4twitter" style="float:left;margin-right: 10px;"><a href="https://twitter.com/share" data-url="http://www.r-bloggers.com/highlight-0-4-2/" data-counturl="http://www.r-bloggers.com/highlight-0-4-2/" data-text="highlight 0.4.2" class="twitter-share-button" data-count="horizontal" data-via="rbloggers"></a></div><div class="socialicons s4plusone" style="float:left;margin-right: 10px;"><g:plusone size="medium" href="http://www.r-bloggers.com/highlight-0-4-2/" count="true"></g:plusone></div></div><div style="clear:both"></div></div>

<div style="border: 1px solid; background: none repeat scroll 0 0 #EDEDED; margin: 1px; font-size: 12px;">
(This article was first published on  <strong><a href="http://blog.r-enthusiasts.com/2013/06/19/highlight-0-4-2/"> R Enthusiasts</a></strong>, and kindly contributed to <a href="http://www.r-bloggers.com/" rel="nofollow">R-bloggers)</a>      
</div></p>
<p>highlight 0.4.2 is on CRAN. This fixes a few bugs reported by users. </p>
<p>The main improvement is that we can now use <code>highlight</code> as a vignette engine, using the functionality introduced <a href="http://cran.r-project.org/doc/manuals/r-release/R-exts.html#Non_002dSweave-vignettes" ref="nofollow" target="_blank">in R 3.0.0</a>. In the <a href="http://www.rcpp.org/" ref="nofollow" target="_blank">Rcpp</a> universe, we use <a data-rhelp="highlight::highlight">highlight</a> to build some of our vignettes, and before this we had to use crazy tricks with <code>Makefile</code>s, etc &#8230; I hope that we won&#8217;t need this anymore with <code>highlight</code> 0.4.2 and I&#8217;ve already started working on using the vignette engine for the <code>RcppGSL</code> vignette. </p>
<p>To use highlight as your vignette engine, you just need to add this line to your <code>DESCRIPTION</code> file: </p>
<pre>
VignetteBuilder: highlight
</pre>
<p>And this somewhere in your vignette: </p>
<pre>
%\VignetteEngine{highlight::highlight}
</pre>
<p>Here is the extract of the <code>NEWS</code> file: </p>
<pre>
0.4.2   2013-06-19

   o    Dealing with spaces that were inserted where they should not have.
        reported by <a href="http://yihui.name/" ref="nofollow" target="_blank">Yihui Xie</a>. 
        
   o    Removing the last line from highligted chunks in the sweave driver
        Requested by <a href="http://dirk.eddelbuettel.com/" ref="nofollow" target="_blank">Dirk Eddelbuettel</a>.
        
   o    Supporting VignetteBuilder: highlight     
</pre>

<p class="syndicated-attribution"><div class="social4i" style="height:82px;"><div class="social4in" style="height:82px;float: left;"><div class="socialicons s4fblike" style="float:left;margin-right: 10px;"><div id="fb-root"></div><div class="fb-like" data-href="http://www.r-bloggers.com/highlight-0-4-2/" data-send="true"  data-layout="box_count" data-width="55" data-height="62"  data-show-faces="false"></div></div><div class="socialicons s4twitter" style="float:left;margin-right: 10px;"><a href="https://twitter.com/share" data-url="http://www.r-bloggers.com/highlight-0-4-2/" data-counturl="http://www.r-bloggers.com/highlight-0-4-2/" data-text="highlight 0.4.2" class="twitter-share-button" data-count="vertical" data-via="rbloggers"></a></div><div class="socialicons s4plusone" style="float:left;margin-right: 10px;"><g:plusone size="tall" href="http://www.r-bloggers.com/highlight-0-4-2/" count="true"></g:plusone></div></div><div style="clear:both"></div></div>

<div style="border: 1px solid; background: none repeat scroll 0 0 #EDEDED; margin: 1px; font-size: 13px;">
<div style="text-align: center;">To <strong>leave a comment</strong> for the author, please follow the link and comment on his blog: <strong><a href="http://blog.r-enthusiasts.com/2013/06/19/highlight-0-4-2/"> R Enthusiasts</a></strong>.</div>
<hr />
<a href="http://www.r-bloggers.com/" rel="nofollow">R-bloggers.com</a> offers <strong><a href="http://feedburner.google.com/fb/a/mailverify?uri=RBloggers" rel="nofollow">daily e-mail updates</a></strong> about <a title="The R Project for Statistical Computing" href="http://www.r-project.org/" rel="nofollow">R</a> news and <a title="R tutorials" href="http://www.r-bloggers.com/?s=tutorial" rel="nofollow">tutorials</a> on topics such as: visualization (<a title="ggplot and ggplot2 tutorials" href="http://www.r-bloggers.com/?s=ggplot2" rel="nofollow">ggplot2</a>, <a title="Boxplots using lattice and ggplot2 tutorials" href="http://www.r-bloggers.com/?s=boxplot" rel="nofollow">Boxplots</a>, <a title="Maps and gis" href="http://www.r-bloggers.com/?s=map" rel="nofollow">maps</a>, <a title="Animation in R" href="http://www.r-bloggers.com/?s=animation" rel="nofollow">animation</a>), programming (<a title="RStudio IDE for R" href="http://www.r-bloggers.com/?s=RStudio" rel="nofollow">RStudio</a>, <a title="Sweave and literate programming" href="http://www.r-bloggers.com/?s=sweave" rel="nofollow">Sweave</a>, <a title="LaTeX in R" href="http://www.r-bloggers.com/?s=LaTeX" rel="nofollow">LaTeX</a>, <a title="SQL and databases" href="http://www.r-bloggers.com/?s=SQL" rel="nofollow">SQL</a>, <a title="Eclipse IDE for R" href="http://www.r-bloggers.com/?s=eclipse" rel="nofollow">Eclipse</a>, <a title="git and github, Version Control System" href="http://www.r-bloggers.com/?s=git" rel="nofollow">git</a>, <a title="Large data in R using Hadoop" href="http://www.r-bloggers.com/?s=hadoop" rel="nofollow">hadoop</a>, <a title="Web Scraping of google, facebook, yahoo, twitter and more using R" href="http://www.r-bloggers.com/?s=Web+Scraping" rel="nofollow">Web Scraping</a>) statistics (<a title="Regressions and ANOVA analysis tutorials" href="http://www.r-bloggers.com/?s=regression" rel="nofollow">regression</a>, <a title="principal component analysis tutorial" href="http://www.r-bloggers.com/?s=PCA" rel="nofollow">PCA</a>, <a title="Time series" href="http://www.r-bloggers.com/?s=time+series" rel="nofollow">time series</a>, <a title="finance trading" href="http://www.r-bloggers.com/?s=trading" rel="nofollow">trading</a>) and more...
</div></p>]]></content:encoded>
			<wfw:commentRss>http://www.r-bloggers.com/highlight-0-4-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="" length="" type="" />
		</item>
		<item>
		<title>ANOVA and Tukey’s test on R</title>
		<link>http://www.r-bloggers.com/anova-and-tukeys-test-on-r/</link>
		<comments>http://www.r-bloggers.com/anova-and-tukeys-test-on-r/#comments</comments>
		<pubDate>Wed, 19 Jun 2013 05:38:26 +0000</pubDate>
		<dc:creator>Flavio Barros</dc:creator>
				<category><![CDATA[R bloggers]]></category>

		<guid isPermaLink="false">http://www.flaviobarros.net/?p=155</guid>
		<description><![CDATA[
<p>OBS: This is a full translation of a portuguese version. In many different types of experiments, with one or more treatments, one of the most widely used statistical methods is analysis of variance or simply ANOVA . The simplest ANOVA can be called &#8220;one way&#8221; or &#8220;single-classification&#8221; and involves the analysis of data sampled from [...]</p>
<p>The post <a href="http://www.flaviobarros.net/2013/06/13/anova-and-tukey-test-on-r/">ANOVA and Tukey&#8217;s test on R</a> appeared first on <a href="http://www.flaviobarros.net/">Flavio Barros</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p class="syndicated-attribution"><div class="social4i" style="height:29px;"><div class="social4in" style="height:29px;float: left;"><div class="socialicons s4fblike" style="float:left;margin-right: 10px;"><div id="fb-root"></div><div class="fb-like" data-href="http://www.r-bloggers.com/anova-and-tukeys-test-on-r/" data-send="true"  data-layout="button_count" data-width="100" data-height="21"  data-show-faces="false"></div></div><div class="socialicons s4twitter" style="float:left;margin-right: 10px;"><a href="https://twitter.com/share" data-url="http://www.r-bloggers.com/anova-and-tukeys-test-on-r/" data-counturl="http://www.r-bloggers.com/anova-and-tukeys-test-on-r/" data-text="ANOVA and Tukey’s test on R" class="twitter-share-button" data-count="horizontal" data-via="rbloggers"></a></div><div class="socialicons s4plusone" style="float:left;margin-right: 10px;"><g:plusone size="medium" href="http://www.r-bloggers.com/anova-and-tukeys-test-on-r/" count="true"></g:plusone></div></div><div style="clear:both"></div></div>

<div style="border: 1px solid; background: none repeat scroll 0 0 #EDEDED; margin: 1px; font-size: 12px;">
(This article was first published on  <strong><a href="http://www.flaviobarros.net/2013/06/13/anova-and-tukey-test-on-r/"> Flavio Barros » r-bloggers</a></strong>, and kindly contributed to <a href="http://www.r-bloggers.com/" rel="nofollow">R-bloggers)</a>      
</div></p>
<p style="text-align: justify;">OBS: This is a full translation of a <span style="color: #0000ff;"><a href="http://www.flaviobarros.net/2013/06/10/anova-e-teste-de-tukey-no-r/" ref="nofollow" target="_blank"><span style="color: #0000ff;">portuguese version</span></a>.</span></p>
<p style="text-align: justify;">In many different types of experiments, with one or more treatments, one of the most widely used statistical methods is analysis of variance or simply <span style="color: #0000ff;"><a href="https://en.wikipedia.org/wiki/Analysis_of_variance" ref="nofollow" target="_blank"><span style="color: #0000ff;">ANOVA</span></a></span> . The simplest ANOVA can be called &#8220;one way&#8221; or &#8220;single-classification&#8221; and involves the analysis of data sampled from more then one population or data from experiments with more than two treatments.</p>
<p style="text-align: justify;">It&#8217;s not my intent to study in depth the ANOVA, but to show how to apply the procedure in R and apply a &#8220;post-hoc&#8221; test called <span style="color: #0000ff;"><a href="http://en.wikipedia.org/wiki/Tukey%27s_range_test" ref="nofollow" target="_blank"><span style="color: #0000ff;">Tukey&#8217;s test</span></a></span>. When we are conducting an analysis of variance, the null hypothesis considered is that there is no difference in treatments mean, so once rejected the null hypothesis, the question is what treatment differ.</p>
<p style="text-align: justify;">To illustrate the procedure we consider an experimental situation where a company is applying a sensory test for a set of 15 panelists in three different brands of chocolate. Three brands are compared, one being the reference, and the goal is to verify the difference of marks with the control. In this experiment we have two factors, the brand and the tasters, and we hope that there is no significant effect of tasters. At each assessment the assessor must determine the difference on a scale 0-7.</p>
<pre class="brush: r; title: ; notranslate">
data.frame(
  Sabor =
  c(5, 7, 3,
    4, 2, 6,
    5, 3, 6,
    5, 6, 0,
    7, 4, 0,
    7, 7, 0,
    6, 6, 0,
    4, 6, 1,
    6, 4, 0,
    7, 7, 0,
    2, 4, 0,
    5, 7, 4,
    7, 5, 0,
    4, 5, 0,
    6, 6, 3
  ),
Tipo = factor(rep(c(&quot;A&quot;, &quot;B&quot;, &quot;C&quot;), 15)),
Provador = factor(rep(1:15, rep(3, 15))))
</pre>
<p style="text-align: justify;">The average grade for types A, B and C were respectively 5.33 5.27 and 1.53. Clearly C, the control, was not different for most of the tasters, as expected. One way to easily obtain these averages per group is using <strong><a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/tapply.html" ref="nofollow" target="_blank"><span style="color: #0000ff;">tapply</span></a>.</strong></p>
<pre class="brush: r; title: ; notranslate">
tapply(chocolate$Sabor, chocolate$Tipo, mean)
</pre>
<p style="text-align: justify;">Finally we run ANOVA and assess whether there are differences between brands and tasters.</p>
<pre class="brush: r; title: ; notranslate">
ajuste &lt;- lm(chocolate$Sabor ~ chocolate$Tipo + chocolate$Provador)
summary(ajuste)
anova(ajuste)
</pre>
<p>what results:</p>
<pre tabindex="0">Analysis of Variance Table

Response: chocolate$Sabor
                   Df  Sum Sq Mean Sq F value    Pr(&gt;F)    
chocolate$Tipo      2 141.911  70.956   19.21 5.598e-06 ***
chocolate$Provador 14  32.578   2.327    0.63    0.8175    
Residuals          28 103.422   3.694                      
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1</pre>
<p style="text-align: justify;">From the output we see that the p-value is 0.8175 for tasters indicating that the assessors have no significant effect on the response. This is desirable since it is expected that the testers can discern correctly the marks of  chocolate. Also in the table we see that the ANOVA p-value for the type of chocolate is highly significant, indicating the difference between the marks. So from now on we can make the Tukey test to see where the differences lie.</p>
<pre class="brush: r; title: ; notranslate">
a1 &lt;- aov(chocolate$Sabor ~ chocolate$Tipo + chocolate$Provador)
posthoc &lt;- TukeyHSD(x=a1, 'chocolate$Tipo', conf.level=0.95)
</pre>
<p>that results:</p>
<pre tabindex="0">  Tukey multiple comparisons of means
    95% family-wise confidence level

Fit: aov(formula = chocolate$Sabor ~ chocolate$Tipo + chocolate$Provador)

$`chocolate$Tipo`
           diff       lwr       upr     p adj
B-A -0.06666667 -1.803101  1.669768 0.9950379
C-A -3.80000000 -5.536435 -2.063565 0.0000260
C-B -3.73333333 -5.469768 -1.996899 0.0000337</pre>
<p style="text-align: justify;">This output indicates that the differences C-A and C-B are significant , while B-A is not significant. A more &#8220;easy&#8221; way to interpret this output is visualizing the confidence intervals for the mean differences.</p>
<pre class="brush: r; title: ; notranslate">
plot(a1)
</pre>
<p><a href="http://www.flaviobarros.net/wp-content/uploads/2013/06/Rplot.jpeg" ref="nofollow" target="_blank"><img class="aligncenter size-full wp-image-106" alt="Rplot" src="http://www.flaviobarros.net/wp-content/uploads/2013/06/Rplot.jpeg" width="727" height="442" /></a></p>
<p style="text-align: justify;">One can see that only the confidence interval for B-A contain 0. Thus, it appears that the marks A and B do not differ among themselves, but are different from brand control.</p>
<p style="text-align: justify;">Finally an alternative way to evaluate the differences in a way more similar to the <span style="color: #0000ff;"><a href="http://www.sas.com/" ref="nofollow" target="_blank"><span style="color: #0000ff;">SAS</span></a></span> is using the package <a href="http://cran.r-project.org/web/packages/agricolae/index.html" ref="nofollow" target="_blank"><span style="color: #0000ff;"><strong>agricolae</strong></span></a>. With it we will apply the same procedure, but the output is slightly different.</p>
<pre class="brush: r; title: ; notranslate">
library(agricolae)
HSD.test(ajuste, 'chocolate$Tipo')
</pre>
<pre tabindex="0">Study:

HSD Test for chocolate$Sabor 

Mean Square Error:  3.693651 

chocolate$Tipo,  means

  chocolate.Sabor   std.err  r Min. Max.
A        5.333333 0.3737413 15    2    7
B        5.266667 0.4078593 15    2    7
C        1.533333 0.5844547 15    0    6

alpha: 0.05 ; Df Error: 28 
Critical Value of Studentized Range: 3.49926 

Honestly Significant Difference: 1.736435 

Means with the same letter are not significantly different.

Groups, Treatments and means
a 	 A 	 5.333 
a 	 B 	 5.267 
b 	 C 	 1.533</pre>
<p style="text-align: justify;">where the final output indicates that both A and B belong to the same group, the &#8216;a&#8217;, and C is different from the other two, belongs to the group &#8216;b&#8217;.</p>
<p>The post <a href="http://www.flaviobarros.net/2013/06/13/anova-and-tukey-test-on-r/" ref="nofollow" target="_blank">ANOVA and Tukey&#8217;s test on R</a> appeared first on <a href="http://www.flaviobarros.net/" ref="nofollow" target="_blank">Flavio Barros</a>.</p>
<p class="syndicated-attribution"><div class="social4i" style="height:82px;"><div class="social4in" style="height:82px;float: left;"><div class="socialicons s4fblike" style="float:left;margin-right: 10px;"><div id="fb-root"></div><div class="fb-like" data-href="http://www.r-bloggers.com/anova-and-tukeys-test-on-r/" data-send="true"  data-layout="box_count" data-width="55" data-height="62"  data-show-faces="false"></div></div><div class="socialicons s4twitter" style="float:left;margin-right: 10px;"><a href="https://twitter.com/share" data-url="http://www.r-bloggers.com/anova-and-tukeys-test-on-r/" data-counturl="http://www.r-bloggers.com/anova-and-tukeys-test-on-r/" data-text="ANOVA and Tukey’s test on R" class="twitter-share-button" data-count="vertical" data-via="rbloggers"></a></div><div class="socialicons s4plusone" style="float:left;margin-right: 10px;"><g:plusone size="tall" href="http://www.r-bloggers.com/anova-and-tukeys-test-on-r/" count="true"></g:plusone></div></div><div style="clear:both"></div></div>

<div style="border: 1px solid; background: none repeat scroll 0 0 #EDEDED; margin: 1px; font-size: 13px;">
<div style="text-align: center;">To <strong>leave a comment</strong> for the author, please follow the link and comment on his blog: <strong><a href="http://www.flaviobarros.net/2013/06/13/anova-and-tukey-test-on-r/"> Flavio Barros » r-bloggers</a></strong>.</div>
<hr />
<a href="http://www.r-bloggers.com/" rel="nofollow">R-bloggers.com</a> offers <strong><a href="http://feedburner.google.com/fb/a/mailverify?uri=RBloggers" rel="nofollow">daily e-mail updates</a></strong> about <a title="The R Project for Statistical Computing" href="http://www.r-project.org/" rel="nofollow">R</a> news and <a title="R tutorials" href="http://www.r-bloggers.com/?s=tutorial" rel="nofollow">tutorials</a> on topics such as: visualization (<a title="ggplot and ggplot2 tutorials" href="http://www.r-bloggers.com/?s=ggplot2" rel="nofollow">ggplot2</a>, <a title="Boxplots using lattice and ggplot2 tutorials" href="http://www.r-bloggers.com/?s=boxplot" rel="nofollow">Boxplots</a>, <a title="Maps and gis" href="http://www.r-bloggers.com/?s=map" rel="nofollow">maps</a>, <a title="Animation in R" href="http://www.r-bloggers.com/?s=animation" rel="nofollow">animation</a>), programming (<a title="RStudio IDE for R" href="http://www.r-bloggers.com/?s=RStudio" rel="nofollow">RStudio</a>, <a title="Sweave and literate programming" href="http://www.r-bloggers.com/?s=sweave" rel="nofollow">Sweave</a>, <a title="LaTeX in R" href="http://www.r-bloggers.com/?s=LaTeX" rel="nofollow">LaTeX</a>, <a title="SQL and databases" href="http://www.r-bloggers.com/?s=SQL" rel="nofollow">SQL</a>, <a title="Eclipse IDE for R" href="http://www.r-bloggers.com/?s=eclipse" rel="nofollow">Eclipse</a>, <a title="git and github, Version Control System" href="http://www.r-bloggers.com/?s=git" rel="nofollow">git</a>, <a title="Large data in R using Hadoop" href="http://www.r-bloggers.com/?s=hadoop" rel="nofollow">hadoop</a>, <a title="Web Scraping of google, facebook, yahoo, twitter and more using R" href="http://www.r-bloggers.com/?s=Web+Scraping" rel="nofollow">Web Scraping</a>) statistics (<a title="Regressions and ANOVA analysis tutorials" href="http://www.r-bloggers.com/?s=regression" rel="nofollow">regression</a>, <a title="principal component analysis tutorial" href="http://www.r-bloggers.com/?s=PCA" rel="nofollow">PCA</a>, <a title="Time series" href="http://www.r-bloggers.com/?s=time+series" rel="nofollow">time series</a>, <a title="finance trading" href="http://www.r-bloggers.com/?s=trading" rel="nofollow">trading</a>) and more...
</div></p>]]></content:encoded>
			<wfw:commentRss>http://www.r-bloggers.com/anova-and-tukeys-test-on-r/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dallas R Users: Creating R Packages this Saturday, 6/22</title>
		<link>http://www.r-bloggers.com/dallas-r-users-creating-r-packages-this-saturday-622/</link>
		<comments>http://www.r-bloggers.com/dallas-r-users-creating-r-packages-this-saturday-622/#comments</comments>
		<pubDate>Wed, 19 Jun 2013 03:53:32 +0000</pubDate>
		<dc:creator>Jeff Allen</dc:creator>
				<category><![CDATA[R bloggers]]></category>

		<guid isPermaLink="false">http://trestletechnology.net/?p=331</guid>
		<description><![CDATA[I&#8217;ll be presenting at the Dallas R Users Group this Saturday at 10:00AM at the University of Dallas on how to reproduce your R code. We&#8217;ll review how to use R scripts, how to embed R code in reproducible documents, and then introduce how to create your own R packages based on your R code. [...]]]></description>
				<content:encoded><![CDATA[<p class="syndicated-attribution"><div class="social4i" style="height:29px;"><div class="social4in" style="height:29px;float: left;"><div class="socialicons s4fblike" style="float:left;margin-right: 10px;"><div id="fb-root"></div><div class="fb-like" data-href="http://www.r-bloggers.com/dallas-r-users-creating-r-packages-this-saturday-622/" data-send="true"  data-layout="button_count" data-width="100" data-height="21"  data-show-faces="false"></div></div><div class="socialicons s4twitter" style="float:left;margin-right: 10px;"><a href="https://twitter.com/share" data-url="http://www.r-bloggers.com/dallas-r-users-creating-r-packages-this-saturday-622/" data-counturl="http://www.r-bloggers.com/dallas-r-users-creating-r-packages-this-saturday-622/" data-text="Dallas R Users: Creating R Packages this Saturday, 6/22" class="twitter-share-button" data-count="horizontal" data-via="rbloggers"></a></div><div class="socialicons s4plusone" style="float:left;margin-right: 10px;"><g:plusone size="medium" href="http://www.r-bloggers.com/dallas-r-users-creating-r-packages-this-saturday-622/" count="true"></g:plusone></div></div><div style="clear:both"></div></div>

<div style="border: 1px solid; background: none repeat scroll 0 0 #EDEDED; margin: 1px; font-size: 12px;">
(This article was first published on  <strong><a href="http://trestletechnology.net/2013/06/dallas-r-users-creating-r-packages-this-saturday-622/"> Trestle Technology » R</a></strong>, and kindly contributed to <a href="http://www.r-bloggers.com/" rel="nofollow">R-bloggers)</a>      
</div></p>
<p>I&#8217;ll be presenting at the Dallas R Users Group this Saturday at 10:00AM at the University of Dallas on how to reproduce your R code. We&#8217;ll review how to use R scripts, how to embed R code in reproducible documents, and then introduce how to create your own R packages based on your R code. At the end of the afternoon, you&#8217;ll be familiar with the entire process of creating an R package to be shared on a repository like CRAN or Bioconductor. No programming background is required &#8211; the entire process will be done within RStudio and the R code we&#8217;ll be using will be very basic.</p>
<p>Attendance is, as always, free and all in the Dallas/Ft. Worth metroplex are welcome! Details and directions can be found on the Meetup page below.</p>
<p><a href="http://www.meetup.com/Dallas-R-Users-Group/events/124213832/" ref="nofollow" target="_blank">http://www.meetup.com/Dallas-R-Users-Group/events/124213832/</a></p>
<p>See you there!</p>

<p class="syndicated-attribution"><div class="social4i" style="height:82px;"><div class="social4in" style="height:82px;float: left;"><div class="socialicons s4fblike" style="float:left;margin-right: 10px;"><div id="fb-root"></div><div class="fb-like" data-href="http://www.r-bloggers.com/dallas-r-users-creating-r-packages-this-saturday-622/" data-send="true"  data-layout="box_count" data-width="55" data-height="62"  data-show-faces="false"></div></div><div class="socialicons s4twitter" style="float:left;margin-right: 10px;"><a href="https://twitter.com/share" data-url="http://www.r-bloggers.com/dallas-r-users-creating-r-packages-this-saturday-622/" data-counturl="http://www.r-bloggers.com/dallas-r-users-creating-r-packages-this-saturday-622/" data-text="Dallas R Users: Creating R Packages this Saturday, 6/22" class="twitter-share-button" data-count="vertical" data-via="rbloggers"></a></div><div class="socialicons s4plusone" style="float:left;margin-right: 10px;"><g:plusone size="tall" href="http://www.r-bloggers.com/dallas-r-users-creating-r-packages-this-saturday-622/" count="true"></g:plusone></div></div><div style="clear:both"></div></div>

<div style="border: 1px solid; background: none repeat scroll 0 0 #EDEDED; margin: 1px; font-size: 13px;">
<div style="text-align: center;">To <strong>leave a comment</strong> for the author, please follow the link and comment on his blog: <strong><a href="http://trestletechnology.net/2013/06/dallas-r-users-creating-r-packages-this-saturday-622/"> Trestle Technology » R</a></strong>.</div>
<hr />
<a href="http://www.r-bloggers.com/" rel="nofollow">R-bloggers.com</a> offers <strong><a href="http://feedburner.google.com/fb/a/mailverify?uri=RBloggers" rel="nofollow">daily e-mail updates</a></strong> about <a title="The R Project for Statistical Computing" href="http://www.r-project.org/" rel="nofollow">R</a> news and <a title="R tutorials" href="http://www.r-bloggers.com/?s=tutorial" rel="nofollow">tutorials</a> on topics such as: visualization (<a title="ggplot and ggplot2 tutorials" href="http://www.r-bloggers.com/?s=ggplot2" rel="nofollow">ggplot2</a>, <a title="Boxplots using lattice and ggplot2 tutorials" href="http://www.r-bloggers.com/?s=boxplot" rel="nofollow">Boxplots</a>, <a title="Maps and gis" href="http://www.r-bloggers.com/?s=map" rel="nofollow">maps</a>, <a title="Animation in R" href="http://www.r-bloggers.com/?s=animation" rel="nofollow">animation</a>), programming (<a title="RStudio IDE for R" href="http://www.r-bloggers.com/?s=RStudio" rel="nofollow">RStudio</a>, <a title="Sweave and literate programming" href="http://www.r-bloggers.com/?s=sweave" rel="nofollow">Sweave</a>, <a title="LaTeX in R" href="http://www.r-bloggers.com/?s=LaTeX" rel="nofollow">LaTeX</a>, <a title="SQL and databases" href="http://www.r-bloggers.com/?s=SQL" rel="nofollow">SQL</a>, <a title="Eclipse IDE for R" href="http://www.r-bloggers.com/?s=eclipse" rel="nofollow">Eclipse</a>, <a title="git and github, Version Control System" href="http://www.r-bloggers.com/?s=git" rel="nofollow">git</a>, <a title="Large data in R using Hadoop" href="http://www.r-bloggers.com/?s=hadoop" rel="nofollow">hadoop</a>, <a title="Web Scraping of google, facebook, yahoo, twitter and more using R" href="http://www.r-bloggers.com/?s=Web+Scraping" rel="nofollow">Web Scraping</a>) statistics (<a title="Regressions and ANOVA analysis tutorials" href="http://www.r-bloggers.com/?s=regression" rel="nofollow">regression</a>, <a title="principal component analysis tutorial" href="http://www.r-bloggers.com/?s=PCA" rel="nofollow">PCA</a>, <a title="Time series" href="http://www.r-bloggers.com/?s=time+series" rel="nofollow">time series</a>, <a title="finance trading" href="http://www.r-bloggers.com/?s=trading" rel="nofollow">trading</a>) and more...
</div></p>]]></content:encoded>
			<wfw:commentRss>http://www.r-bloggers.com/dallas-r-users-creating-r-packages-this-saturday-622/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="" length="" type="" />
		</item>
		<item>
		<title>Le Monde puzzle [#825]</title>
		<link>http://www.r-bloggers.com/le-monde-puzzle-825/</link>
		<comments>http://www.r-bloggers.com/le-monde-puzzle-825/#comments</comments>
		<pubDate>Tue, 18 Jun 2013 22:13:43 +0000</pubDate>
		<dc:creator>xi'an</dc:creator>
				<category><![CDATA[R bloggers]]></category>

		<guid isPermaLink="false">http://xianblog.wordpress.com/?p=20927</guid>
		<description><![CDATA[Yet another puzzle which first part does not require R programming, even though it is a programming question in essence: Given five real numbers&#160;x1,&#8230;,x5, what is the minimal number of pairwise comparisons needed to rank them? Given 33 real numbers, what is the minimal number of pairwise comparisons required to find the three largest ones? [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=xianblog.wordpress.com&#38;blog=5051449&#38;post=20927&#38;subd=xianblog&#38;ref=&#38;feed=1" width="1" height="1">
]]></description>
				<content:encoded><![CDATA[<p class="syndicated-attribution"><div class="social4i" style="height:29px;"><div class="social4in" style="height:29px;float: left;"><div class="socialicons s4fblike" style="float:left;margin-right: 10px;"><div id="fb-root"></div><div class="fb-like" data-href="http://www.r-bloggers.com/le-monde-puzzle-825/" data-send="true"  data-layout="button_count" data-width="100" data-height="21"  data-show-faces="false"></div></div><div class="socialicons s4twitter" style="float:left;margin-right: 10px;"><a href="https://twitter.com/share" data-url="http://www.r-bloggers.com/le-monde-puzzle-825/" data-counturl="http://www.r-bloggers.com/le-monde-puzzle-825/" data-text="Le Monde puzzle [#825]" class="twitter-share-button" data-count="horizontal" data-via="rbloggers"></a></div><div class="socialicons s4plusone" style="float:left;margin-right: 10px;"><g:plusone size="medium" href="http://www.r-bloggers.com/le-monde-puzzle-825/" count="true"></g:plusone></div></div><div style="clear:both"></div></div>

<div style="border: 1px solid; background: none repeat scroll 0 0 #EDEDED; margin: 1px; font-size: 12px;">
(This article was first published on  <strong><a href="http://xianblog.wordpress.com/2013/06/19/le-monde-puzzle-825/"> Xi&#039;an&#039;s Og » R</a></strong>, and kindly contributed to <a href="http://www.r-bloggers.com/" rel="nofollow">R-bloggers)</a>      
</div></p>
<p style="text-align:justify;"><strong><img class="aligncenter" style="margin-top:4px;margin-bottom:4px;" alt="" src="https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcRsQd3v7efgSlmsNPKddzl-oQS9fZOF8a68V6KPmf5dnmI_EJ66rw" width="273" height="185" />Y</strong>et another puzzle which first part does not require R programming, even though it is a programming question in essence:</p>
<blockquote>
<p style="text-align:justify;"><em>Given five real numbers x<sub>1</sub>,&#8230;,x<sub>5</sub>, what is the minimal number of </em><em>pairwise comparisons needed to rank them? Given 33 real numbers, what is the minimal number of pairwise comparisons required to find the three largest ones?</em></p>
</blockquote>
<p style="text-align:justify;"><strong>I</strong> do not see a way out of considering the first question as the quickest possible sorting of a real sample. Using either <a href="http://en.wikipedia.org/wiki/Quicksort" ref="nofollow" target="_blank">quicksort</a> or <a href="http://en.wikipedia.org/wiki/Heapsort" ref="nofollow" target="_blank">heapsort</a>, I achieve sorting the 5 numbers in exactly 6 comparisons for any order of the initial sample. <em>(Now, there may be an even faster way based on comparing partial sums first&#8230; I just do not see how!)</em></p>
<p style="text-align:justify;"><strong><a href="http://upload.wikimedia.org/wikipedia/commons/thumb/3/38/Max-Heap.svg/240px-Max-Heap.svg.png" ref="nofollow" target="_blank"><img class="aligncenter" alt="" src="http://upload.wikimedia.org/wikipedia/commons/thumb/3/38/Max-Heap.svg/240px-Max-Heap.svg.png" width="240" height="178" /></a>F</strong>or the second part, let us start from the remark that 32 comparisons are needed to find the largest number, then at most 31 for the second largest, and at most 30 for the third largest (since we can take advantage of the partial ordering resulting from the determination of the largest number). This is poor. If I instead use a heap algorithm, I need O(n log{n}) comparisons to build this binary tree whose parents are always larger than their siblings, as in the above example. <em>(I can produce a sort of heap structure, although non-binary, in an average 16&#215;2.5=40 steps. And a maximum 16&#215;3=48 steps.)</em> The resulting tree provides the largest number (100 in the above example) and at least the second largest number (36 in the above). To get the third largest number, I first need a comparison between the one-before-last terms of the heap (19 vs. 36 in the above), and one or two extra comparisons (25 vs. 19 and maybe 25 vs. 1 in the above). <em>(This would induce an average 1.5 extra comparison and a maximum 2 extra comparisons, resulting in a total of 41.5 average and 49.5 maximum comparisons with my sub-optimal heap construction.)</em>  Once again, using comparisons of sums may help in speeding up the process, for instance comparing numbers by groups of 3, but I did not pursue this solution&#8230;</p>
<p style="text-align:justify;"><strong><a href="http://xianblog.files.wordpress.com/2013/06/quick3.jpg" ref="nofollow" target="_blank"><img class="aligncenter size-full wp-image-20934" title="histogram of the number of comparisons involved in the quick3 execution, figure obtained with the par(bg=&quot;black&quot;,col.axis=&quot;wheat&quot;,col.lab=&quot;wheat&quot;) options and 10000 simulations" alt="quick3" src="http://xianblog.files.wordpress.com/2013/06/quick3.jpg?w=450&#038;h=450" width="450" height="450" /></a>I</strong>f instead I try to adapt quicksort to this problem, I can have a dynamic pivot that always keep at most two terms above it, providing the three numbers as a finale result. Here is an R code to check its performances:</p>
<pre class="brush: r; gutter: false; title: ; notranslate">
quick3=function(x){

comp=0
i=1
lower=upper=NULL
pivot=x[1]

for (i in 2:length(x)){

if (x[i]&lt;pivot){ lower=c(lower,x[i])
}else{

upper=c(upper,x[i])
if (length(upper)&gt;1) comp=comp+1}

comp=comp+1

if (length(upper)==3){

pivot=min(upper)
upper=sort(upper)[-1]
}}

if (length(upper)&lt;3) upper=c(pivot,upper)

list(top=upper,cost=comp)
}
</pre>
<p style="text-align:justify;">When running this R code on 10⁴ random sequences of 33 terms, I obtained the following statistics, I obtained the following statistics on the computing costs</p>
<pre class="brush: r; gutter: false; title: ; notranslate">&lt;/p&gt;
&lt;p style=&quot;text-align: justify;&quot;&gt;&gt; summary(costs)
Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
32.00   36.00   38.00   37.89   40.00   49.00
</pre>
<p style="text-align:justify;">and the associated histogram represented above. Interestingly, the minimum is the number of comparisons needed to produce the maximum!</p>
<br />Filed under: <a href='http://xianblog.wordpress.com/category/books/' ref="nofollow" target="_blank">Books</a>, <a href='http://xianblog.wordpress.com/category/kids/' ref="nofollow" target="_blank">Kids</a>, <a href='http://xianblog.wordpress.com/category/pictures/' ref="nofollow" target="_blank">pictures</a>, <a href='http://xianblog.wordpress.com/category/statistics/r-statistics/' ref="nofollow" target="_blank">R</a> Tagged: <a href='http://xianblog.wordpress.com/tag/heapsort/' ref="nofollow" target="_blank">heapsort</a>, <a href='http://xianblog.wordpress.com/tag/le-monde/' ref="nofollow" target="_blank">Le Monde</a>, <a href='http://xianblog.wordpress.com/tag/mathematical-puzzle/' ref="nofollow" target="_blank">mathematical puzzle</a>, <a href='http://xianblog.wordpress.com/tag/pracma/' ref="nofollow" target="_blank">pracma</a>, <a href='http://xianblog.wordpress.com/tag/quicksort/' ref="nofollow" target="_blank">quicksort</a>, <a href='http://xianblog.wordpress.com/tag/r/' ref="nofollow" target="_blank">R</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/xianblog.wordpress.com/20927/" ref="nofollow" target="_blank"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/xianblog.wordpress.com/20927/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=xianblog.wordpress.com&#038;blog=5051449&%23038;post=20927&%23038;subd=xianblog&%23038;ref=&%23038;feed=1" width="1" height="1" />
<p class="syndicated-attribution"><div class="social4i" style="height:82px;"><div class="social4in" style="height:82px;float: left;"><div class="socialicons s4fblike" style="float:left;margin-right: 10px;"><div id="fb-root"></div><div class="fb-like" data-href="http://www.r-bloggers.com/le-monde-puzzle-825/" data-send="true"  data-layout="box_count" data-width="55" data-height="62"  data-show-faces="false"></div></div><div class="socialicons s4twitter" style="float:left;margin-right: 10px;"><a href="https://twitter.com/share" data-url="http://www.r-bloggers.com/le-monde-puzzle-825/" data-counturl="http://www.r-bloggers.com/le-monde-puzzle-825/" data-text="Le Monde puzzle [#825]" class="twitter-share-button" data-count="vertical" data-via="rbloggers"></a></div><div class="socialicons s4plusone" style="float:left;margin-right: 10px;"><g:plusone size="tall" href="http://www.r-bloggers.com/le-monde-puzzle-825/" count="true"></g:plusone></div></div><div style="clear:both"></div></div>

<div style="border: 1px solid; background: none repeat scroll 0 0 #EDEDED; margin: 1px; font-size: 13px;">
<div style="text-align: center;">To <strong>leave a comment</strong> for the author, please follow the link and comment on his blog: <strong><a href="http://xianblog.wordpress.com/2013/06/19/le-monde-puzzle-825/"> Xi&#039;an&#039;s Og » R</a></strong>.</div>
<hr />
<a href="http://www.r-bloggers.com/" rel="nofollow">R-bloggers.com</a> offers <strong><a href="http://feedburner.google.com/fb/a/mailverify?uri=RBloggers" rel="nofollow">daily e-mail updates</a></strong> about <a title="The R Project for Statistical Computing" href="http://www.r-project.org/" rel="nofollow">R</a> news and <a title="R tutorials" href="http://www.r-bloggers.com/?s=tutorial" rel="nofollow">tutorials</a> on topics such as: visualization (<a title="ggplot and ggplot2 tutorials" href="http://www.r-bloggers.com/?s=ggplot2" rel="nofollow">ggplot2</a>, <a title="Boxplots using lattice and ggplot2 tutorials" href="http://www.r-bloggers.com/?s=boxplot" rel="nofollow">Boxplots</a>, <a title="Maps and gis" href="http://www.r-bloggers.com/?s=map" rel="nofollow">maps</a>, <a title="Animation in R" href="http://www.r-bloggers.com/?s=animation" rel="nofollow">animation</a>), programming (<a title="RStudio IDE for R" href="http://www.r-bloggers.com/?s=RStudio" rel="nofollow">RStudio</a>, <a title="Sweave and literate programming" href="http://www.r-bloggers.com/?s=sweave" rel="nofollow">Sweave</a>, <a title="LaTeX in R" href="http://www.r-bloggers.com/?s=LaTeX" rel="nofollow">LaTeX</a>, <a title="SQL and databases" href="http://www.r-bloggers.com/?s=SQL" rel="nofollow">SQL</a>, <a title="Eclipse IDE for R" href="http://www.r-bloggers.com/?s=eclipse" rel="nofollow">Eclipse</a>, <a title="git and github, Version Control System" href="http://www.r-bloggers.com/?s=git" rel="nofollow">git</a>, <a title="Large data in R using Hadoop" href="http://www.r-bloggers.com/?s=hadoop" rel="nofollow">hadoop</a>, <a title="Web Scraping of google, facebook, yahoo, twitter and more using R" href="http://www.r-bloggers.com/?s=Web+Scraping" rel="nofollow">Web Scraping</a>) statistics (<a title="Regressions and ANOVA analysis tutorials" href="http://www.r-bloggers.com/?s=regression" rel="nofollow">regression</a>, <a title="principal component analysis tutorial" href="http://www.r-bloggers.com/?s=PCA" rel="nofollow">PCA</a>, <a title="Time series" href="http://www.r-bloggers.com/?s=time+series" rel="nofollow">time series</a>, <a title="finance trading" href="http://www.r-bloggers.com/?s=trading" rel="nofollow">trading</a>) and more...
</div></p>]]></content:encoded>
			<wfw:commentRss>http://www.r-bloggers.com/le-monde-puzzle-825/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://2.gravatar.com/avatar/ba847ef5873101769043f6260d57282a?s=96&amp;amp;d=http://s0.wp.com/i/mu.gif" length="" type="" />
<enclosure url="https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcRsQd3v7efgSlmsNPKddzl-oQS9fZOF8a68V6KPmf5dnmI_EJ66rw" length="" type="" />
<enclosure url="http://upload.wikimedia.org/wikipedia/commons/thumb/3/38/Max-Heap.svg/240px-Max-Heap.svg.png" length="" type="" />
<enclosure url="http://xianblog.files.wordpress.com/2013/06/quick3.jpg" length="" type="" />
		</item>
		<item>
		<title>Dynamic Data Visualizations in the Browser Using Shiny</title>
		<link>http://www.r-bloggers.com/dynamic-data-visualizations-in-the-browser-using-shiny/</link>
		<comments>http://www.r-bloggers.com/dynamic-data-visualizations-in-the-browser-using-shiny/#comments</comments>
		<pubDate>Tue, 18 Jun 2013 18:11:51 +0000</pubDate>
		<dc:creator>dgrapov</dc:creator>
				<category><![CDATA[R bloggers]]></category>

		<guid isPermaLink="false">http://imdevsoftware.wordpress.com/?p=534</guid>
		<description><![CDATA[After being busy the last two weeks teaching and attending academic conferences, I finally found some time to do what I love, program data visualizations using R. After being interested in Shiny for a while, I finally decided to pull the trigger and build my first Shiny app! I wanted to make a proof of [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=imdevsoftware.wordpress.com&#38;blog=38119978&#38;post=534&#38;subd=imdevsoftware&#38;ref=&#38;feed=1" width="1" height="1">
]]></description>
				<content:encoded><![CDATA[<p class="syndicated-attribution"><div class="social4i" style="height:29px;"><div class="social4in" style="height:29px;float: left;"><div class="socialicons s4fblike" style="float:left;margin-right: 10px;"><div id="fb-root"></div><div class="fb-like" data-href="http://www.r-bloggers.com/dynamic-data-visualizations-in-the-browser-using-shiny/" data-send="true"  data-layout="button_count" data-width="100" data-height="21"  data-show-faces="false"></div></div><div class="socialicons s4twitter" style="float:left;margin-right: 10px;"><a href="https://twitter.com/share" data-url="http://www.r-bloggers.com/dynamic-data-visualizations-in-the-browser-using-shiny/" data-counturl="http://www.r-bloggers.com/dynamic-data-visualizations-in-the-browser-using-shiny/" data-text="Dynamic Data Visualizations in the Browser Using Shiny" class="twitter-share-button" data-count="horizontal" data-via="rbloggers"></a></div><div class="socialicons s4plusone" style="float:left;margin-right: 10px;"><g:plusone size="medium" href="http://www.r-bloggers.com/dynamic-data-visualizations-in-the-browser-using-shiny/" count="true"></g:plusone></div></div><div style="clear:both"></div></div>

<div style="border: 1px solid; background: none repeat scroll 0 0 #EDEDED; margin: 1px; font-size: 12px;">
(This article was first published on  <strong><a href="http://imdevsoftware.wordpress.com/2013/06/16/dynamic-plots-in-using-shiny-and-ggplot2/"> imDEV » r-bloggers</a></strong>, and kindly contributed to <a href="http://www.r-bloggers.com/" rel="nofollow">R-bloggers)</a>      
</div></p>
<p><a href="http://imdevsoftware.files.wordpress.com/2013/06/clipboard033.png" ref="nofollow" target="_blank"><img class="size-full wp-image-549 aligncenter" alt="Clipboard03" src="http://imdevsoftware.files.wordpress.com/2013/06/clipboard033.png?w=590"   /></a></p>
<p>After being busy the last two weeks teaching and attending academic conferences, I finally found some time to do what I love, program data visualizations using R. After being interested in <a href="http://www.rstudio.com/shiny/" ref="nofollow" target="_blank">Shiny</a> for a while, I finally decided to pull the trigger and build my first Shiny app!</p>
<p>I wanted to make a proof of concept app which contained the following dynamics which are the basics of any UI design:</p>
<p>1) dynamic UI options</p>
<p>2) dynamically updated plot based on UI inputs</p>
<p>Here is what I came up with.</p>
<p><a href="http://imdevsoftware.files.wordpress.com/2013/06/boxplot.png" ref="nofollow" target="_blank"><img class="aligncenter size-full wp-image-536" alt="boxplot" src="http://imdevsoftware.files.wordpress.com/2013/06/boxplot.png?w=590"   /></a></p>
<p>Check out the app for yourself  on your local machine or the<a href="https://gist.github.com/dgrapov/5792778" ref="nofollow" target="_blank"> R code HERE</a>.</p>
<pre class="brush: r; title: ; notranslate">
library(shiny)
runGist('5792778')
</pre>
<p>The app consists of a user interface (UI)  for selecting the data, variable to plot , grouping factor for colors and four plotting options: boxplot (above), histogram, density plot and bar graph. As an added bonus the user can select to show or hide jittered points in the boxplot visualization.</p>
<p>Generally #2 above was well described and easy to implement, but it took a lot of trial and error to figure out how to implement #1. Basically to generate dynamic UI objects, the UI objects need to be called using the function shiny:::uiOutput()  in the ui.R file and their arguments set in the server.R file using the function shiny:::renderUI(). After getting this to work everything else fell in place.</p>
<p>Having some experience with making UI&#8217;s in VBA (visual basic) and <a href="http://cran.r-project.org/web/packages/gWidgets/index.html" ref="nofollow" target="_blank">gWidgets</a>; Shiny is a joy to work with once you understand some of its inner workings. One aspect I felt which made the learning experience frustrating was the lack of informative errors coming from Shiny functions. Even using all the R debugging tools having Shiny constantly tell me something was not correctly called from a reactive environment or the error was in the runApp() did not really help. My advice to anyone learning Shiny is to take a look at the <a href="http://rstudio.github.io/shiny/tutorial/" ref="nofollow" target="_blank">tutorials</a>, and particularly the section on Dynamic UI. Then pick a small example to reverse engineer. Don&#8217;t start off too complicated else you will have a hard time understanding which sections of code are not working as expected.</p>
<p>Finally here are some screen shots, and keep an eye out for more advanced shiny apps in the near future.</p>
<p><a href="http://imdevsoftware.files.wordpress.com/2013/06/density-plot.png" ref="nofollow" target="_blank"><img class="aligncenter size-full wp-image-538" alt="density plot" src="http://imdevsoftware.files.wordpress.com/2013/06/density-plot.png?w=590"   /></a> <a href="http://imdevsoftware.files.wordpress.com/2013/06/histogram.png" ref="nofollow" target="_blank"><img class="aligncenter size-full wp-image-537" alt="histogram" src="http://imdevsoftware.files.wordpress.com/2013/06/histogram.png?w=590"   /></a> <a href="http://imdevsoftware.files.wordpress.com/2013/06/bar.png" ref="nofollow" target="_blank"><img class="aligncenter size-full wp-image-535" alt="bar" src="http://imdevsoftware.files.wordpress.com/2013/06/bar.png?w=590"   /></a></p>
<br />  <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=imdevsoftware.wordpress.com&#038;blog=38119978&%23038;post=534&%23038;subd=imdevsoftware&%23038;ref=&%23038;feed=1" width="1" height="1" />
<p class="syndicated-attribution"><div class="social4i" style="height:82px;"><div class="social4in" style="height:82px;float: left;"><div class="socialicons s4fblike" style="float:left;margin-right: 10px;"><div id="fb-root"></div><div class="fb-like" data-href="http://www.r-bloggers.com/dynamic-data-visualizations-in-the-browser-using-shiny/" data-send="true"  data-layout="box_count" data-width="55" data-height="62"  data-show-faces="false"></div></div><div class="socialicons s4twitter" style="float:left;margin-right: 10px;"><a href="https://twitter.com/share" data-url="http://www.r-bloggers.com/dynamic-data-visualizations-in-the-browser-using-shiny/" data-counturl="http://www.r-bloggers.com/dynamic-data-visualizations-in-the-browser-using-shiny/" data-text="Dynamic Data Visualizations in the Browser Using Shiny" class="twitter-share-button" data-count="vertical" data-via="rbloggers"></a></div><div class="socialicons s4plusone" style="float:left;margin-right: 10px;"><g:plusone size="tall" href="http://www.r-bloggers.com/dynamic-data-visualizations-in-the-browser-using-shiny/" count="true"></g:plusone></div></div><div style="clear:both"></div></div>

<div style="border: 1px solid; background: none repeat scroll 0 0 #EDEDED; margin: 1px; font-size: 13px;">
<div style="text-align: center;">To <strong>leave a comment</strong> for the author, please follow the link and comment on his blog: <strong><a href="http://imdevsoftware.wordpress.com/2013/06/16/dynamic-plots-in-using-shiny-and-ggplot2/"> imDEV » r-bloggers</a></strong>.</div>
<hr />
<a href="http://www.r-bloggers.com/" rel="nofollow">R-bloggers.com</a> offers <strong><a href="http://feedburner.google.com/fb/a/mailverify?uri=RBloggers" rel="nofollow">daily e-mail updates</a></strong> about <a title="The R Project for Statistical Computing" href="http://www.r-project.org/" rel="nofollow">R</a> news and <a title="R tutorials" href="http://www.r-bloggers.com/?s=tutorial" rel="nofollow">tutorials</a> on topics such as: visualization (<a title="ggplot and ggplot2 tutorials" href="http://www.r-bloggers.com/?s=ggplot2" rel="nofollow">ggplot2</a>, <a title="Boxplots using lattice and ggplot2 tutorials" href="http://www.r-bloggers.com/?s=boxplot" rel="nofollow">Boxplots</a>, <a title="Maps and gis" href="http://www.r-bloggers.com/?s=map" rel="nofollow">maps</a>, <a title="Animation in R" href="http://www.r-bloggers.com/?s=animation" rel="nofollow">animation</a>), programming (<a title="RStudio IDE for R" href="http://www.r-bloggers.com/?s=RStudio" rel="nofollow">RStudio</a>, <a title="Sweave and literate programming" href="http://www.r-bloggers.com/?s=sweave" rel="nofollow">Sweave</a>, <a title="LaTeX in R" href="http://www.r-bloggers.com/?s=LaTeX" rel="nofollow">LaTeX</a>, <a title="SQL and databases" href="http://www.r-bloggers.com/?s=SQL" rel="nofollow">SQL</a>, <a title="Eclipse IDE for R" href="http://www.r-bloggers.com/?s=eclipse" rel="nofollow">Eclipse</a>, <a title="git and github, Version Control System" href="http://www.r-bloggers.com/?s=git" rel="nofollow">git</a>, <a title="Large data in R using Hadoop" href="http://www.r-bloggers.com/?s=hadoop" rel="nofollow">hadoop</a>, <a title="Web Scraping of google, facebook, yahoo, twitter and more using R" href="http://www.r-bloggers.com/?s=Web+Scraping" rel="nofollow">Web Scraping</a>) statistics (<a title="Regressions and ANOVA analysis tutorials" href="http://www.r-bloggers.com/?s=regression" rel="nofollow">regression</a>, <a title="principal component analysis tutorial" href="http://www.r-bloggers.com/?s=PCA" rel="nofollow">PCA</a>, <a title="Time series" href="http://www.r-bloggers.com/?s=time+series" rel="nofollow">time series</a>, <a title="finance trading" href="http://www.r-bloggers.com/?s=trading" rel="nofollow">trading</a>) and more...
</div></p>]]></content:encoded>
			<wfw:commentRss>http://www.r-bloggers.com/dynamic-data-visualizations-in-the-browser-using-shiny/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://imdevsoftware.files.wordpress.com/2013/06/clipboard033.png" length="" type="" />
<enclosure url="http://imdevsoftware.files.wordpress.com/2013/06/boxplot.png" length="" type="" />
<enclosure url="http://imdevsoftware.files.wordpress.com/2013/06/density-plot.png" length="" type="" />
<enclosure url="http://imdevsoftware.files.wordpress.com/2013/06/histogram.png" length="" type="" />
<enclosure url="http://imdevsoftware.files.wordpress.com/2013/06/bar.png" length="" type="" />
		</item>
		<item>
		<title>Printing R help files in the console or in knitr documents</title>
		<link>http://www.r-bloggers.com/printing-r-help-files-in-the-console-or-in-knitr-documents/</link>
		<comments>http://www.r-bloggers.com/printing-r-help-files-in-the-console-or-in-knitr-documents/#comments</comments>
		<pubDate>Tue, 18 Jun 2013 17:57:22 +0000</pubDate>
		<dc:creator>Noam Ross</dc:creator>
				<category><![CDATA[R bloggers]]></category>

		<guid isPermaLink="false">http://www.r-bloggers.com/?guid=08dc59b03a0562e6eaa873c3d4875d5b</guid>
		<description><![CDATA[
  <p>Yesterday, I was creating a <code>knitr</code> document based on a script, and was looking for a way to include content from an R help file. The script, which was a teaching document, had a <code>help()</code> command for when the author wanted to refer readers to R documentation. I wanted that text in my final document, though.</p>
<p>There&#8217;s no standard way to do this in R, but with some help from <a href="http://stackoverflow.com/questions/7493843/how-to-write-contents-of-help-to-a-file-from-within-r">Stack Overflow</a> and <a href="https://gist.github.com/SChamberlain/5801605">Scott Chamberlain</a>, I figured out I needed some functions hidden in the depths of the <code>tools</code> package. So I wrote this function:</p>
<pre><code>help_console &#60;-<span> </span>function(topic, <span>format=</span><span>c</span>(<span>"text"</span>, <span>"html"</span>, <span>"latex"</span>, <span>"Rd"</span>),
                         <span>lines=</span><span>NULL</span>, <span>before=</span><span>NULL</span>, <span>after=</span><span>NULL</span>) {  
  format=<span>match.arg</span>(format)
  if (!<span>is.character</span>(topic)) topic &#60;-<span> </span><span>deparse</span>(<span>substitute</span>(topic))
  helpfile =<span> </span>utils:::<span>.getHelpFile</span>(<span>help</span>(topic))

  hs &#60;-<span> </span><span>capture.output</span>(switch(format, 
                              <span>text=</span>tools:::<span>Rd2txt</span>(helpfile),
                              <span>html=</span>tools:::<span>Rd2HTML</span>(helpfile),
                              <span>latex=</span>tools:::<span>Rd2latex</span>(helpfile),
                              <span>Rd=</span>tools:::<span>prepare_Rd</span>(helpfile)
                              )
                      )
  if(!<span>is.null</span>(lines)) hs &#60;-<span> </span>hs[lines]
  hs &#60;-<span> </span><span>c</span>(before, hs, after)
  <span>cat</span>(hs, <span>sep=</span><span>"</span><span>\n</span><span>"</span>)
  <span>invisible</span>(hs)
}</code></pre>
<p><code>help_console</code> prints the help file to the console or lets you assign the help file text to a character. Below, I use it to dynamically print the start of the help file for the <code>optim()</code> function as quoted HTML (note that the <code>knitr</code> chunk has the option <code>results='asis')</code>:</p>
<pre><code><span>help_console</span>(optim, <span>"html"</span>, <span>lines =</span> <span>1</span>:<span>25</span>, <span>before =</span> <span>"&#60;blockquote&#62;"</span>, <span>after =</span> <span>"&#60;/blockquote&#62;"</span>)</code></pre>
<blockquote>

<title>
R: General-purpose Optimization
</title>

<table width="100%" summary="page for optim"><tr>
<td>
optim
</td>
<td align="right">
R Documentation
</td>
</tr></table>
<h2>
General-purpose Optimization
</h2>

<h3>
Description
</h3>

<p>
General-purpose optimization based on Nelder&#8211;Mead, quasi-Newton and conjugate-gradient algorithms. It includes an option for box-constrained optimization and simulated annealing.
</p>


<h3>
Usage
</h3>

<pre>
optim(par, fn, gr = NULL, &#8230;, method = c(&#8220;Nelder-Mead&#8221;, &#8220;BFGS&#8221;, &#8220;CG&#8221;, &#8220;L-BFGS-B&#8221;, &#8220;SANN&#8221;, &#8220;Brent&#8221;), lower = -Inf, upper = Inf, control = list(), hessian = FALSE)
</pre>
</blockquote>


<p>The function is part of my <a href="https://github.com/noamross/noamtools/blob/master/R/help_console.R"><code>noamtools</code> package on GitHub</a>, where I keep various convenience functions. Enjoy, and fork if you have improvements!</p>
]]></description>
				<content:encoded><![CDATA[<p class="syndicated-attribution"><div class="social4i" style="height:29px;"><div class="social4in" style="height:29px;float: left;"><div class="socialicons s4fblike" style="float:left;margin-right: 10px;"><div id="fb-root"></div><div class="fb-like" data-href="http://www.r-bloggers.com/printing-r-help-files-in-the-console-or-in-knitr-documents/" data-send="true"  data-layout="button_count" data-width="100" data-height="21"  data-show-faces="false"></div></div><div class="socialicons s4twitter" style="float:left;margin-right: 10px;"><a href="https://twitter.com/share" data-url="http://www.r-bloggers.com/printing-r-help-files-in-the-console-or-in-knitr-documents/" data-counturl="http://www.r-bloggers.com/printing-r-help-files-in-the-console-or-in-knitr-documents/" data-text="Printing R help files in the console or in knitr documents" class="twitter-share-button" data-count="horizontal" data-via="rbloggers"></a></div><div class="socialicons s4plusone" style="float:left;margin-right: 10px;"><g:plusone size="medium" href="http://www.r-bloggers.com/printing-r-help-files-in-the-console-or-in-knitr-documents/" count="true"></g:plusone></div></div><div style="clear:both"></div></div>

<div style="border: 1px solid; background: none repeat scroll 0 0 #EDEDED; margin: 1px; font-size: 12px;">
(This article was first published on  <strong><a href="http://www.noamross.net/blog/2013/6/18/helpconsoleexample.html"> Noam Ross - R</a></strong>, and kindly contributed to <a href="http://www.r-bloggers.com/" rel="nofollow">R-bloggers)</a>      
</div></p>
<head>
  <style type="text/css"  media="all">
    table tbody {border-top:2px; border-bottom:2px;}
    table thead {border-bottom:1px;}
  </style>
</head> <p>Yesterday, I was creating a <code>knitr</code> document based on a script, and was looking for a way to include content from an R help file. The script, which was a teaching document, had a <code>help()</code> command for when the author wanted to refer readers to R documentation. I wanted that text in my final document, though.</p>
<p>There’s no standard way to do this in R, but with some help from <a href="http://stackoverflow.com/questions/7493843/how-to-write-contents-of-help-to-a-file-from-within-r" ref="nofollow" target="_blank">Stack Overflow</a> and <a href="https://gist.github.com/SChamberlain/5801605" ref="nofollow" target="_blank">Scott Chamberlain</a>, I figured out I needed some functions hidden in the depths of the <code>tools</code> package. So I wrote this function:</p>
<pre class="sourceCode r"><code class="sourceCode r">help_console &lt;-<span class="st"> </span>function(topic, <span class="dt">format=</span><span class="kw">c</span>(<span class="st">&quot;text&quot;</span>, <span class="st">&quot;html&quot;</span>, <span class="st">&quot;latex&quot;</span>, <span class="st">&quot;Rd&quot;</span>),
                         <span class="dt">lines=</span><span class="ot">NULL</span>, <span class="dt">before=</span><span class="ot">NULL</span>, <span class="dt">after=</span><span class="ot">NULL</span>) {  
  format=<span class="kw">match.arg</span>(format)
  if (!<span class="kw">is.character</span>(topic)) topic &lt;-<span class="st"> </span><span class="kw">deparse</span>(<span class="kw">substitute</span>(topic))
  helpfile =<span class="st"> </span>utils:::<span class="kw">.getHelpFile</span>(<span class="kw">help</span>(topic))

  hs &lt;-<span class="st"> </span><span class="kw">capture.output</span>(switch(format, 
                              <span class="dt">text=</span>tools:::<span class="kw">Rd2txt</span>(helpfile),
                              <span class="dt">html=</span>tools:::<span class="kw">Rd2HTML</span>(helpfile),
                              <span class="dt">latex=</span>tools:::<span class="kw">Rd2latex</span>(helpfile),
                              <span class="dt">Rd=</span>tools:::<span class="kw">prepare_Rd</span>(helpfile)
                              )
                      )
  if(!<span class="kw">is.null</span>(lines)) hs &lt;-<span class="st"> </span>hs[lines]
  hs &lt;-<span class="st"> </span><span class="kw">c</span>(before, hs, after)
  <span class="kw">cat</span>(hs, <span class="dt">sep=</span><span class="st">&quot;</span><span class="ch">\n</span><span class="st">&quot;</span>)
  <span class="kw">invisible</span>(hs)
}</code></pre>
<p><code>help_console</code> prints the help file to the console or lets you assign the help file text to a character. Below, I use it to dynamically print the start of the help file for the <code>optim()</code> function as quoted HTML (note that the <code>knitr</code> chunk has the option <code>results='asis')</code>:</p>
<pre class="sourceCode r"><code class="sourceCode r"><span class="kw">help_console</span>(optim, <span class="st">&quot;html&quot;</span>, <span class="dt">lines =</span> <span class="dv">1</span>:<span class="dv">25</span>, <span class="dt">before =</span> <span class="st">&quot;&lt;blockquote&gt;&quot;</span>, <span class="dt">after =</span> <span class="st">&quot;&lt;/blockquote&gt;&quot;</span>)</code></pre>
<blockquote>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>
R: General-purpose Optimization
</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <link rel="stylesheet" type="text/css" href="http://www.noamross.net/blog/2013/6/18/R.css">
</head><body>

<table width="100%" summary="page for optim"><tr><td>
optim
</td><td align="right">
R Documentation
</td></tr></table>

<h2>
General-purpose Optimization
</h2>

<h3>
Description
</h3>

<p>
General-purpose optimization based on Nelder–Mead, quasi-Newton and conjugate-gradient algorithms. It includes an option for box-constrained optimization and simulated annealing.
</p>


<h3>
Usage
</h3>

<pre>
optim(par, fn, gr = NULL, …, method = c(“Nelder-Mead”, “BFGS”, “CG”, “L-BFGS-B”, “SANN”, “Brent”), lower = -Inf, upper = Inf, control = list(), hessian = FALSE)
</blockquote>


<p>The function is part of my <a href="https://github.com/noamross/noamtools/blob/master/R/help_console.R" ref="nofollow" target="_blank"><code>noamtools</code> package on GitHub</a>, where I keep various convenience functions. Enjoy, and fork if you have improvements!</p>
<p class="syndicated-attribution"><div class="social4i" style="height:82px;"><div class="social4in" style="height:82px;float: left;"><div class="socialicons s4fblike" style="float:left;margin-right: 10px;"><div id="fb-root"></div><div class="fb-like" data-href="http://www.r-bloggers.com/printing-r-help-files-in-the-console-or-in-knitr-documents/" data-send="true"  data-layout="box_count" data-width="55" data-height="62"  data-show-faces="false"></div></div><div class="socialicons s4twitter" style="float:left;margin-right: 10px;"><a href="https://twitter.com/share" data-url="http://www.r-bloggers.com/printing-r-help-files-in-the-console-or-in-knitr-documents/" data-counturl="http://www.r-bloggers.com/printing-r-help-files-in-the-console-or-in-knitr-documents/" data-text="Printing R help files in the console or in knitr documents" class="twitter-share-button" data-count="vertical" data-via="rbloggers"></a></div><div class="socialicons s4plusone" style="float:left;margin-right: 10px;"><g:plusone size="tall" href="http://www.r-bloggers.com/printing-r-help-files-in-the-console-or-in-knitr-documents/" count="true"></g:plusone></div></div><div style="clear:both"></div></div>

<div style="border: 1px solid; background: none repeat scroll 0 0 #EDEDED; margin: 1px; font-size: 13px;">
<div style="text-align: center;">To <strong>leave a comment</strong> for the author, please follow the link and comment on his blog: <strong><a href="http://www.noamross.net/blog/2013/6/18/helpconsoleexample.html"> Noam Ross - R</a></strong>.</div>
<hr />
<a href="http://www.r-bloggers.com/" rel="nofollow">R-bloggers.com</a> offers <strong><a href="http://feedburner.google.com/fb/a/mailverify?uri=RBloggers" rel="nofollow">daily e-mail updates</a></strong> about <a title="The R Project for Statistical Computing" href="http://www.r-project.org/" rel="nofollow">R</a> news and <a title="R tutorials" href="http://www.r-bloggers.com/?s=tutorial" rel="nofollow">tutorials</a> on topics such as: visualization (<a title="ggplot and ggplot2 tutorials" href="http://www.r-bloggers.com/?s=ggplot2" rel="nofollow">ggplot2</a>, <a title="Boxplots using lattice and ggplot2 tutorials" href="http://www.r-bloggers.com/?s=boxplot" rel="nofollow">Boxplots</a>, <a title="Maps and gis" href="http://www.r-bloggers.com/?s=map" rel="nofollow">maps</a>, <a title="Animation in R" href="http://www.r-bloggers.com/?s=animation" rel="nofollow">animation</a>), programming (<a title="RStudio IDE for R" href="http://www.r-bloggers.com/?s=RStudio" rel="nofollow">RStudio</a>, <a title="Sweave and literate programming" href="http://www.r-bloggers.com/?s=sweave" rel="nofollow">Sweave</a>, <a title="LaTeX in R" href="http://www.r-bloggers.com/?s=LaTeX" rel="nofollow">LaTeX</a>, <a title="SQL and databases" href="http://www.r-bloggers.com/?s=SQL" rel="nofollow">SQL</a>, <a title="Eclipse IDE for R" href="http://www.r-bloggers.com/?s=eclipse" rel="nofollow">Eclipse</a>, <a title="git and github, Version Control System" href="http://www.r-bloggers.com/?s=git" rel="nofollow">git</a>, <a title="Large data in R using Hadoop" href="http://www.r-bloggers.com/?s=hadoop" rel="nofollow">hadoop</a>, <a title="Web Scraping of google, facebook, yahoo, twitter and more using R" href="http://www.r-bloggers.com/?s=Web+Scraping" rel="nofollow">Web Scraping</a>) statistics (<a title="Regressions and ANOVA analysis tutorials" href="http://www.r-bloggers.com/?s=regression" rel="nofollow">regression</a>, <a title="principal component analysis tutorial" href="http://www.r-bloggers.com/?s=PCA" rel="nofollow">PCA</a>, <a title="Time series" href="http://www.r-bloggers.com/?s=time+series" rel="nofollow">time series</a>, <a title="finance trading" href="http://www.r-bloggers.com/?s=trading" rel="nofollow">trading</a>) and more...
</div></p>]]></content:encoded>
			<wfw:commentRss>http://www.r-bloggers.com/printing-r-help-files-in-the-console-or-in-knitr-documents/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="" length="" type="" />
		</item>
		<item>
		<title>Resources for getting started with R</title>
		<link>http://www.r-bloggers.com/resources-for-getting-started-with-r/</link>
		<comments>http://www.r-bloggers.com/resources-for-getting-started-with-r/#comments</comments>
		<pubDate>Tue, 18 Jun 2013 17:25:25 +0000</pubDate>
		<dc:creator>Kushan Shah</dc:creator>
				<category><![CDATA[R bloggers]]></category>

		<guid isPermaLink="false">http://www.tatvic.com/blog/?p=4219</guid>
		<description><![CDATA[As we believe you may know, we are having a webinar tomorrow (June 19th, 2013) on Predictive Analytics. During this webinar, you are going to be introduced to R, learn how to build a predictive model and also how to carry insightful analysis through visualization. As learning a new language can be a really difficult [...]]]></description>
				<content:encoded><![CDATA[<p class="syndicated-attribution"><div class="social4i" style="height:29px;"><div class="social4in" style="height:29px;float: left;"><div class="socialicons s4fblike" style="float:left;margin-right: 10px;"><div id="fb-root"></div><div class="fb-like" data-href="http://www.r-bloggers.com/resources-for-getting-started-with-r/" data-send="true"  data-layout="button_count" data-width="100" data-height="21"  data-show-faces="false"></div></div><div class="socialicons s4twitter" style="float:left;margin-right: 10px;"><a href="https://twitter.com/share" data-url="http://www.r-bloggers.com/resources-for-getting-started-with-r/" data-counturl="http://www.r-bloggers.com/resources-for-getting-started-with-r/" data-text="Resources for getting started with R" class="twitter-share-button" data-count="horizontal" data-via="rbloggers"></a></div><div class="socialicons s4plusone" style="float:left;margin-right: 10px;"><g:plusone size="medium" href="http://www.r-bloggers.com/resources-for-getting-started-with-r/" count="true"></g:plusone></div></div><div style="clear:both"></div></div>

<div style="border: 1px solid; background: none repeat scroll 0 0 #EDEDED; margin: 1px; font-size: 12px;">
(This article was first published on  <strong><a href="http://www.tatvic.com/blog/resources-for-getting-started-with-r/"> Tatvic Blog » R</a></strong>, and kindly contributed to <a href="http://www.r-bloggers.com/" rel="nofollow">R-bloggers)</a>      
</div></p>
<p></p><p>As we believe you may know, we are having a webinar tomorrow (June 19<sup>th</sup>, 2013) on Predictive Analytics. During this webinar, you are going to be introduced to R, learn how to build a predictive model and also how to carry insightful analysis through visualization.</p><p>As learning a new language can be a really difficult and painful process, we thought that it would be a valuable idea to share useful links for R resources with you. If you can spare some time to read some of these links, we believe that this first briefing will enable you to come with a better background to our webinar.</p><p>So, what do you say? Are you in for a reading and for reducing your learning curve?</p><p><strong>Downloads</strong></p><p>R : <a href="http://www.r-project.org/" ref="nofollow" target="_blank">http://www.r-project.org/</a><br
/> Choose your nearest download location and click on the appropriate link<br
/> RStudio : <a href="http://www.rstudio.com/" ref="nofollow" target="_blank">http://www.rstudio.com/</a></p><p><strong>Packages</strong></p><p>RGoogleAnalytics :<a href="https://code.google.com/p/r-google-analytics/" ref="nofollow" target="_blank">https://code.google.com/p/r-google-analytics/</a><br
/> Guide to getting started with RGoogleAnalytics :<a href="http://bit.ly/11kUgzI" ref="nofollow" target="_blank">http://bit.ly/11kUgzI</a><br
/> Guide to getting started with ggplot2 :<a href="http://www.cookbook-r.com/Graphs/" ref="nofollow" target="_blank">http://www.cookbook-r.com/Graphs/</a><br
/> Ggplot2 chart chooser :<a href="http://www.yaksis.com/posts/r-chart-chooser.html" ref="nofollow" target="_blank">http://www.yaksis.com/posts/r-chart-chooser.html</a><br
/> Finding additional R packages for your domain : <a href="http://cran.r-project.org/web/views/" ref="nofollow" target="_blank">http://cran.r-project.org/web/views/</a><br
/> Additional Ideas for Predictive modelling :http://bit.ly/13XyCCK</p><p><strong>Courses on R</strong></p><p>Codeschool : <a href="http://tryr.codeschool.com/" ref="nofollow" target="_blank">http://tryr.codeschool.com/</a><br
/> 2 minute short videos on R: <a href="http://www.twotorials.com/" ref="nofollow" target="_blank">http://www.twotorials.com/</a></p><p><strong>Community</strong></p><p>A Prezi tour of the R ecosystem :<a href="http://prezi.com/s1qrgfm9ko4i/the-r-ecosystem/" ref="nofollow" target="_blank">http://prezi.com/s1qrgfm9ko4i/the-r-ecosystem/</a><br
/> R news and tutorials from prominent R blogs : <a href="http://www.r-bloggers.com/" ref="nofollow" target="_blank">http://www.r-bloggers.com/</a><br
/> A search engine for R: <a href="http://www.rseek.org/" ref="nofollow" target="_blank">http://www.rseek.org/</a></p><p>If you come across more resources, please ensure that you drop a comment below.</p><div
class="wp-about-author-containter-top" style="background-color:#FFEAA8;"><div
class="wp-about-author-pic"><img
src="http://www.tatvic.com/blog/wp-content/uploads/userphoto/20.jpg" alt="Kushan Shah" width="60" class="photo" /></div><div
class="wp-about-author-text"><h3><a href='http://www.tatvic.com/blog/author/kushan/' title='Kushan Shah' ref="nofollow" target="_blank">Kushan Shah</a></h3><p>Kushan is a Web Analyst at Tatvic. His interests lie in getting the maximum insights out of raw data using R and Python.</p><p><a href='http://www.tatvic.com/' title='Kushan Shah' ref="nofollow" target="_blank">Website</a> - <a href='http://twitter.com/kushan_s' title='Kushan Shah on Twitter' rel='nofollow' ref="nofollow" target="_blank">Twitter</a> - <a href='https://www.facebook.com/kushan.shah1?ref=tn_tnmn' title='Kushan Shah on Facebook' rel='nofollow' ref="nofollow" target="_blank">Facebook</a> - <a href='http://www.tatvic.com/blog/author/kushan/' title='More posts by Kushan Shah' ref="nofollow" target="_blank">More Posts</a></p></div></div><div
align="right" style="float: right; clear:left; padding: 0px 5px 0px 7px;"><a
name="fb_share" type="box_count" share_url="http://www.tatvic.com/blog/resources-for-getting-started-with-r/"></a></div>
<p class="syndicated-attribution"><div class="social4i" style="height:82px;"><div class="social4in" style="height:82px;float: left;"><div class="socialicons s4fblike" style="float:left;margin-right: 10px;"><div id="fb-root"></div><div class="fb-like" data-href="http://www.r-bloggers.com/resources-for-getting-started-with-r/" data-send="true"  data-layout="box_count" data-width="55" data-height="62"  data-show-faces="false"></div></div><div class="socialicons s4twitter" style="float:left;margin-right: 10px;"><a href="https://twitter.com/share" data-url="http://www.r-bloggers.com/resources-for-getting-started-with-r/" data-counturl="http://www.r-bloggers.com/resources-for-getting-started-with-r/" data-text="Resources for getting started with R" class="twitter-share-button" data-count="vertical" data-via="rbloggers"></a></div><div class="socialicons s4plusone" style="float:left;margin-right: 10px;"><g:plusone size="tall" href="http://www.r-bloggers.com/resources-for-getting-started-with-r/" count="true"></g:plusone></div></div><div style="clear:both"></div></div>

<div style="border: 1px solid; background: none repeat scroll 0 0 #EDEDED; margin: 1px; font-size: 13px;">
<div style="text-align: center;">To <strong>leave a comment</strong> for the author, please follow the link and comment on his blog: <strong><a href="http://www.tatvic.com/blog/resources-for-getting-started-with-r/"> Tatvic Blog » R</a></strong>.</div>
<hr />
<a href="http://www.r-bloggers.com/" rel="nofollow">R-bloggers.com</a> offers <strong><a href="http://feedburner.google.com/fb/a/mailverify?uri=RBloggers" rel="nofollow">daily e-mail updates</a></strong> about <a title="The R Project for Statistical Computing" href="http://www.r-project.org/" rel="nofollow">R</a> news and <a title="R tutorials" href="http://www.r-bloggers.com/?s=tutorial" rel="nofollow">tutorials</a> on topics such as: visualization (<a title="ggplot and ggplot2 tutorials" href="http://www.r-bloggers.com/?s=ggplot2" rel="nofollow">ggplot2</a>, <a title="Boxplots using lattice and ggplot2 tutorials" href="http://www.r-bloggers.com/?s=boxplot" rel="nofollow">Boxplots</a>, <a title="Maps and gis" href="http://www.r-bloggers.com/?s=map" rel="nofollow">maps</a>, <a title="Animation in R" href="http://www.r-bloggers.com/?s=animation" rel="nofollow">animation</a>), programming (<a title="RStudio IDE for R" href="http://www.r-bloggers.com/?s=RStudio" rel="nofollow">RStudio</a>, <a title="Sweave and literate programming" href="http://www.r-bloggers.com/?s=sweave" rel="nofollow">Sweave</a>, <a title="LaTeX in R" href="http://www.r-bloggers.com/?s=LaTeX" rel="nofollow">LaTeX</a>, <a title="SQL and databases" href="http://www.r-bloggers.com/?s=SQL" rel="nofollow">SQL</a>, <a title="Eclipse IDE for R" href="http://www.r-bloggers.com/?s=eclipse" rel="nofollow">Eclipse</a>, <a title="git and github, Version Control System" href="http://www.r-bloggers.com/?s=git" rel="nofollow">git</a>, <a title="Large data in R using Hadoop" href="http://www.r-bloggers.com/?s=hadoop" rel="nofollow">hadoop</a>, <a title="Web Scraping of google, facebook, yahoo, twitter and more using R" href="http://www.r-bloggers.com/?s=Web+Scraping" rel="nofollow">Web Scraping</a>) statistics (<a title="Regressions and ANOVA analysis tutorials" href="http://www.r-bloggers.com/?s=regression" rel="nofollow">regression</a>, <a title="principal component analysis tutorial" href="http://www.r-bloggers.com/?s=PCA" rel="nofollow">PCA</a>, <a title="Time series" href="http://www.r-bloggers.com/?s=time+series" rel="nofollow">time series</a>, <a title="finance trading" href="http://www.r-bloggers.com/?s=trading" rel="nofollow">trading</a>) and more...
</div></p>]]></content:encoded>
			<wfw:commentRss>http://www.r-bloggers.com/resources-for-getting-started-with-r/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="" length="" type="" />
		</item>
		<item>
		<title>BCEA 1.3.0</title>
		<link>http://www.r-bloggers.com/bcea-1-3-0/</link>
		<comments>http://www.r-bloggers.com/bcea-1-3-0/#comments</comments>
		<pubDate>Tue, 18 Jun 2013 16:35:00 +0000</pubDate>
		<dc:creator>Gianluca Baio</dc:creator>
				<category><![CDATA[R bloggers]]></category>

		<guid isPermaLink="false">http://www.r-bloggers.com/?guid=f00ac06d6abd50927a2897d74c3f28c4</guid>
		<description><![CDATA[After months of work (although to be fair, we haven't worked 100% full time on this), Andrea and I are nearly ready to publish the next release of BCEA.&#160;Andrea has done a brilliant job and is responsible for most of the good new features (NB: see ...]]></description>
				<content:encoded><![CDATA[<p class="syndicated-attribution"><div class="social4i" style="height:29px;"><div class="social4in" style="height:29px;float: left;"><div class="socialicons s4fblike" style="float:left;margin-right: 10px;"><div id="fb-root"></div><div class="fb-like" data-href="http://www.r-bloggers.com/bcea-1-3-0/" data-send="true"  data-layout="button_count" data-width="100" data-height="21"  data-show-faces="false"></div></div><div class="socialicons s4twitter" style="float:left;margin-right: 10px;"><a href="https://twitter.com/share" data-url="http://www.r-bloggers.com/bcea-1-3-0/" data-counturl="http://www.r-bloggers.com/bcea-1-3-0/" data-text="BCEA 1.3.0" class="twitter-share-button" data-count="horizontal" data-via="rbloggers"></a></div><div class="socialicons s4plusone" style="float:left;margin-right: 10px;"><g:plusone size="medium" href="http://www.r-bloggers.com/bcea-1-3-0/" count="true"></g:plusone></div></div><div style="clear:both"></div></div>

<div style="border: 1px solid; background: none repeat scroll 0 0 #EDEDED; margin: 1px; font-size: 12px;">
(This article was first published on  <strong><a href="http://gianlubaio.blogspot.com/2013/06/bcea-130.html"> Gianluca Baio's blog</a></strong>, and kindly contributed to <a href="http://www.r-bloggers.com/" rel="nofollow">R-bloggers)</a>      
</div></p>
<div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/-W4lHcNONLfA/UcCJ-w9iomI/AAAAAAAAA24/8URNo2xQlG0/s1600/coming-soon-sign.gif" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;" ref="nofollow" target="_blank"><img border="0" height="187" src="http://1.bp.blogspot.com/-W4lHcNONLfA/UcCJ-w9iomI/AAAAAAAAA24/8URNo2xQlG0/s200/coming-soon-sign.gif" width="200" /></a></div><span style="font-family: Trebuchet MS, sans-serif;">After months of work (although to be fair, we haven't worked 100% full time on this), <a href="http://it.linkedin.com/in/andberardi" ref="nofollow" target="_blank">Andrea</a> and I are nearly ready to publish the next release of <a href="http://www.statistica.it/gianluca/BCEA" ref="nofollow" target="_blank">BCEA</a>.&nbsp;</span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;">Andrea has done a brilliant job and is responsible for most of the good new features <i>(<b>NB</b>: see what I'm doing here? Subtly putting the blame on him if things go tits up, but also appearing like a magnanimous supervisor who's only pretending not to deserve full credit, if they don't...)</i>.&nbsp;</span><br /><span style="font-family: 'Trebuchet MS', sans-serif;"><br /></span><span style="font-family: 'Trebuchet MS', sans-serif;">But, seriously, I really mean that he's been brilliant, especially since he had to put up with my being extremely picky on details like font size and similar!&nbsp;</span><span style="font-family: 'Trebuchet MS', sans-serif;">Anyway, we're really excited (well, at least as excited as you can be about a computer package) about the new features, which basically are of three types.</span><br /><span style="font-family: 'Trebuchet MS', sans-serif;"><br /></span><ol><li><span style="font-family: Trebuchet MS, sans-serif;">The first one is in terms of the graphical capabilities of the package. We have implemented all the graphical functions in </span><a href="http://ggplot2.org/" ref="nofollow" target="_blank"><span style="font-family: Courier New, Courier, monospace;">ggplot2</span></a><span style="font-family: Trebuchet MS, sans-serif;">, which now complements the base graphical engine.</span></li><li><span style="font-family: Trebuchet MS, sans-serif;">The second one is that we have included the possibility of running multiple health economic comparisons in a single evaluation. In the current version of BCEA, you are allowed to have many interventions, but the comparisons are performed pairwise against one of them, which the user defines as the "reference" intervention. Now, it will be possible to produce an analysis of all the interventions jointly. This has clear links with multiple treatment comparisons (as pointed out in chapter 9 <a href="http://www.amazon.co.uk/Evidence-Synthesis-Decision-Healthcare-Statistics/dp/047006109X" ref="nofollow" target="_blank">here</a>).</span></li><li><span style="font-family: Trebuchet MS, sans-serif;">The third new feature allows the user to compute the expected value of partial information (EVPPI), with respect to one of the parameters included in the model. This is a very important aspect of the process of probabilistic sensitivity analysis and normally is performed using a two-stage MCMC process (which is explained in chapter 3 and 4 of <a href="http://www.statistica.it/gianluca/BMHE" ref="nofollow" target="_blank">BMHE</a>). But this can be (and nearly always is) a very computationally intensive process. Also, you can't use too few iterations in either of the two MCMC stages, because that has a crucial impact on the precision of the results. Also, it is difficult to standardise the analysis using the two-stage MCMC approach, because it depends very much on the model being fitted. However, <a href="http://www.pharmacy.ubc.ca/node/136" ref="nofollow" target="_blank">Mohsen Sadatsafavi</a>&nbsp;and colleagues have recently published a <a href="http://www.sciencedirect.com/science/article/pii/S1098301512041721?np=y" ref="nofollow" target="_blank">paper</a> in which they found a clever way of approximating the EVPPI, once the original model has been run (ie with a single MCMC step, which you would do anyway). I wasn't aware of the paper, but after Mohsen contacted me and pointed it out, I decided we should implement it in BCEA.</span></li></ol><div><span style="font-family: Trebuchet MS, sans-serif;">I'm not completely sold on the </span><span style="font-family: Courier New, Courier, monospace;">ggplot2</span><span style="font-family: Trebuchet MS, sans-serif;"> thing. I think it can be very good and gives you a lot of freedom and flexibility. But sometimes it feels like overkilling it, really. But, for example, it will be helpful in problems with multiple interventions, where it is more important that the user can customise the resulting graphs, given that they can be very cluttered, if there are many interventions being compared at the same time (at the moment we allow a maximum of 6).</span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;">In the next couple of days we'll release the new version as some sort of beta test. We have done some tests ourselves, of course, and everything seems to work OK. But of course it would be good if we could get more feedbacks on different problems.</span></div>
<p class="syndicated-attribution"><div class="social4i" style="height:82px;"><div class="social4in" style="height:82px;float: left;"><div class="socialicons s4fblike" style="float:left;margin-right: 10px;"><div id="fb-root"></div><div class="fb-like" data-href="http://www.r-bloggers.com/bcea-1-3-0/" data-send="true"  data-layout="box_count" data-width="55" data-height="62"  data-show-faces="false"></div></div><div class="socialicons s4twitter" style="float:left;margin-right: 10px;"><a href="https://twitter.com/share" data-url="http://www.r-bloggers.com/bcea-1-3-0/" data-counturl="http://www.r-bloggers.com/bcea-1-3-0/" data-text="BCEA 1.3.0" class="twitter-share-button" data-count="vertical" data-via="rbloggers"></a></div><div class="socialicons s4plusone" style="float:left;margin-right: 10px;"><g:plusone size="tall" href="http://www.r-bloggers.com/bcea-1-3-0/" count="true"></g:plusone></div></div><div style="clear:both"></div></div>

<div style="border: 1px solid; background: none repeat scroll 0 0 #EDEDED; margin: 1px; font-size: 13px;">
<div style="text-align: center;">To <strong>leave a comment</strong> for the author, please follow the link and comment on his blog: <strong><a href="http://gianlubaio.blogspot.com/2013/06/bcea-130.html"> Gianluca Baio's blog</a></strong>.</div>
<hr />
<a href="http://www.r-bloggers.com/" rel="nofollow">R-bloggers.com</a> offers <strong><a href="http://feedburner.google.com/fb/a/mailverify?uri=RBloggers" rel="nofollow">daily e-mail updates</a></strong> about <a title="The R Project for Statistical Computing" href="http://www.r-project.org/" rel="nofollow">R</a> news and <a title="R tutorials" href="http://www.r-bloggers.com/?s=tutorial" rel="nofollow">tutorials</a> on topics such as: visualization (<a title="ggplot and ggplot2 tutorials" href="http://www.r-bloggers.com/?s=ggplot2" rel="nofollow">ggplot2</a>, <a title="Boxplots using lattice and ggplot2 tutorials" href="http://www.r-bloggers.com/?s=boxplot" rel="nofollow">Boxplots</a>, <a title="Maps and gis" href="http://www.r-bloggers.com/?s=map" rel="nofollow">maps</a>, <a title="Animation in R" href="http://www.r-bloggers.com/?s=animation" rel="nofollow">animation</a>), programming (<a title="RStudio IDE for R" href="http://www.r-bloggers.com/?s=RStudio" rel="nofollow">RStudio</a>, <a title="Sweave and literate programming" href="http://www.r-bloggers.com/?s=sweave" rel="nofollow">Sweave</a>, <a title="LaTeX in R" href="http://www.r-bloggers.com/?s=LaTeX" rel="nofollow">LaTeX</a>, <a title="SQL and databases" href="http://www.r-bloggers.com/?s=SQL" rel="nofollow">SQL</a>, <a title="Eclipse IDE for R" href="http://www.r-bloggers.com/?s=eclipse" rel="nofollow">Eclipse</a>, <a title="git and github, Version Control System" href="http://www.r-bloggers.com/?s=git" rel="nofollow">git</a>, <a title="Large data in R using Hadoop" href="http://www.r-bloggers.com/?s=hadoop" rel="nofollow">hadoop</a>, <a title="Web Scraping of google, facebook, yahoo, twitter and more using R" href="http://www.r-bloggers.com/?s=Web+Scraping" rel="nofollow">Web Scraping</a>) statistics (<a title="Regressions and ANOVA analysis tutorials" href="http://www.r-bloggers.com/?s=regression" rel="nofollow">regression</a>, <a title="principal component analysis tutorial" href="http://www.r-bloggers.com/?s=PCA" rel="nofollow">PCA</a>, <a title="Time series" href="http://www.r-bloggers.com/?s=time+series" rel="nofollow">time series</a>, <a title="finance trading" href="http://www.r-bloggers.com/?s=trading" rel="nofollow">trading</a>) and more...
</div></p>]]></content:encoded>
			<wfw:commentRss>http://www.r-bloggers.com/bcea-1-3-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="" length="" type="" />
		</item>
		<item>
		<title>R GIS: Terrain Analysis for Polygons as Simple as it Gets!</title>
		<link>http://www.r-bloggers.com/r-gis-terrain-analysis-for-polygons-as-simple-as-it-gets/</link>
		<comments>http://www.r-bloggers.com/r-gis-terrain-analysis-for-polygons-as-simple-as-it-gets/#comments</comments>
		<pubDate>Tue, 18 Jun 2013 15:16:00 +0000</pubDate>
		<dc:creator>Kay Cichini</dc:creator>
				<category><![CDATA[R bloggers]]></category>

		<guid isPermaLink="false">http://www.r-bloggers.com/?guid=13b614ab1331f9ff364a6e95732f74ea</guid>
		<description><![CDATA[
<a href="http://3.bp.blogspot.com/-aZBDc2mQ-TU/UcB4qQ-TzaI/AAAAAAAACbg/VDAhe6ZieCw/s1600/terrain.png"><img border="0" src="http://3.bp.blogspot.com/-aZBDc2mQ-TU/UcB4qQ-TzaI/AAAAAAAACbg/VDAhe6ZieCw/s200/terrain.png"></a><br /><pre>library(raster)<br />library(rgdal)<br /><br />alt gadm gadm_sub <br />plot(alt)<br />plot(gadm_sub, add=T)<br /><br />asp slo <br />&#62; extract(slo, gadm_sub, fun = mean, na.rm = T, small = T, df = T)<br />  ID     slope<br />1  1  9.959053<br />2  2  1.047443<br />3  3  7.456165<br />4  4  1.673786<br />5  5 11.946553<br /><br />&#62; extract(asp, gadm_sub, fun = mean, na.rm = T, small = T, df = T)<br />  ID   aspect<br />1  1 170.8065<br />2  2 184.0130<br />3  3 190.7155<br />4  4 136.8953<br />5  5 205.2115<br /></pre>
]]></description>
				<content:encoded><![CDATA[<p class="syndicated-attribution"><div class="social4i" style="height:29px;"><div class="social4in" style="height:29px;float: left;"><div class="socialicons s4fblike" style="float:left;margin-right: 10px;"><div id="fb-root"></div><div class="fb-like" data-href="http://www.r-bloggers.com/r-gis-terrain-analysis-for-polygons-as-simple-as-it-gets/" data-send="true"  data-layout="button_count" data-width="100" data-height="21"  data-show-faces="false"></div></div><div class="socialicons s4twitter" style="float:left;margin-right: 10px;"><a href="https://twitter.com/share" data-url="http://www.r-bloggers.com/r-gis-terrain-analysis-for-polygons-as-simple-as-it-gets/" data-counturl="http://www.r-bloggers.com/r-gis-terrain-analysis-for-polygons-as-simple-as-it-gets/" data-text="R GIS: Terrain Analysis for Polygons as Simple as it Gets!" class="twitter-share-button" data-count="horizontal" data-via="rbloggers"></a></div><div class="socialicons s4plusone" style="float:left;margin-right: 10px;"><g:plusone size="medium" href="http://www.r-bloggers.com/r-gis-terrain-analysis-for-polygons-as-simple-as-it-gets/" count="true"></g:plusone></div></div><div style="clear:both"></div></div>

<div style="border: 1px solid; background: none repeat scroll 0 0 #EDEDED; margin: 1px; font-size: 12px;">
(This article was first published on  <strong><a href="http://thebiobucket.blogspot.com/2013/06/r-gis-terrain-analysis-for-polygons-as.html"> theBioBucket*</a></strong>, and kindly contributed to <a href="http://www.r-bloggers.com/" rel="nofollow">R-bloggers)</a>      
</div></p>
<a href="http://3.bp.blogspot.com/-aZBDc2mQ-TU/UcB4qQ-TzaI/AAAAAAAACbg/VDAhe6ZieCw/s1600/terrain.png" imageanchor="1" ref="nofollow" target="_blank"><img border="0" src="http://3.bp.blogspot.com/-aZBDc2mQ-TU/UcB4qQ-TzaI/AAAAAAAACbg/VDAhe6ZieCw/s200/terrain.png" /></a><br /><pre class="brush:r">library(raster)<br />library(rgdal)<br /><br />alt <- getData('alt', country = "AT")<br />gadm <- getData('GADM', country = "AT", level = 2)<br />gadm_sub <- gadm[1:3, ]<br /><br />plot(alt)<br />plot(gadm_sub, add=T)<br /><br />asp <- terrain(alt, opt = "aspect", unit = "degrees", df = F)<br />slo <- terrain(alt, opt = "slope", unit = "degrees", df = F)<br /><br />> extract(slo, gadm_sub, fun = mean, na.rm = T, small = T, df = T)<br />  ID     slope<br />1  1  9.959053<br />2  2  1.047443<br />3  3  7.456165<br />4  4  1.673786<br />5  5 11.946553<br /><br />> extract(asp, gadm_sub, fun = mean, na.rm = T, small = T, df = T)<br />  ID   aspect<br />1  1 170.8065<br />2  2 184.0130<br />3  3 190.7155<br />4  4 136.8953<br />5  5 205.2115<br /></pre>
<p class="syndicated-attribution"><div class="social4i" style="height:82px;"><div class="social4in" style="height:82px;float: left;"><div class="socialicons s4fblike" style="float:left;margin-right: 10px;"><div id="fb-root"></div><div class="fb-like" data-href="http://www.r-bloggers.com/r-gis-terrain-analysis-for-polygons-as-simple-as-it-gets/" data-send="true"  data-layout="box_count" data-width="55" data-height="62"  data-show-faces="false"></div></div><div class="socialicons s4twitter" style="float:left;margin-right: 10px;"><a href="https://twitter.com/share" data-url="http://www.r-bloggers.com/r-gis-terrain-analysis-for-polygons-as-simple-as-it-gets/" data-counturl="http://www.r-bloggers.com/r-gis-terrain-analysis-for-polygons-as-simple-as-it-gets/" data-text="R GIS: Terrain Analysis for Polygons as Simple as it Gets!" class="twitter-share-button" data-count="vertical" data-via="rbloggers"></a></div><div class="socialicons s4plusone" style="float:left;margin-right: 10px;"><g:plusone size="tall" href="http://www.r-bloggers.com/r-gis-terrain-analysis-for-polygons-as-simple-as-it-gets/" count="true"></g:plusone></div></div><div style="clear:both"></div></div>

<div style="border: 1px solid; background: none repeat scroll 0 0 #EDEDED; margin: 1px; font-size: 13px;">
<div style="text-align: center;">To <strong>leave a comment</strong> for the author, please follow the link and comment on his blog: <strong><a href="http://thebiobucket.blogspot.com/2013/06/r-gis-terrain-analysis-for-polygons-as.html"> theBioBucket*</a></strong>.</div>
<hr />
<a href="http://www.r-bloggers.com/" rel="nofollow">R-bloggers.com</a> offers <strong><a href="http://feedburner.google.com/fb/a/mailverify?uri=RBloggers" rel="nofollow">daily e-mail updates</a></strong> about <a title="The R Project for Statistical Computing" href="http://www.r-project.org/" rel="nofollow">R</a> news and <a title="R tutorials" href="http://www.r-bloggers.com/?s=tutorial" rel="nofollow">tutorials</a> on topics such as: visualization (<a title="ggplot and ggplot2 tutorials" href="http://www.r-bloggers.com/?s=ggplot2" rel="nofollow">ggplot2</a>, <a title="Boxplots using lattice and ggplot2 tutorials" href="http://www.r-bloggers.com/?s=boxplot" rel="nofollow">Boxplots</a>, <a title="Maps and gis" href="http://www.r-bloggers.com/?s=map" rel="nofollow">maps</a>, <a title="Animation in R" href="http://www.r-bloggers.com/?s=animation" rel="nofollow">animation</a>), programming (<a title="RStudio IDE for R" href="http://www.r-bloggers.com/?s=RStudio" rel="nofollow">RStudio</a>, <a title="Sweave and literate programming" href="http://www.r-bloggers.com/?s=sweave" rel="nofollow">Sweave</a>, <a title="LaTeX in R" href="http://www.r-bloggers.com/?s=LaTeX" rel="nofollow">LaTeX</a>, <a title="SQL and databases" href="http://www.r-bloggers.com/?s=SQL" rel="nofollow">SQL</a>, <a title="Eclipse IDE for R" href="http://www.r-bloggers.com/?s=eclipse" rel="nofollow">Eclipse</a>, <a title="git and github, Version Control System" href="http://www.r-bloggers.com/?s=git" rel="nofollow">git</a>, <a title="Large data in R using Hadoop" href="http://www.r-bloggers.com/?s=hadoop" rel="nofollow">hadoop</a>, <a title="Web Scraping of google, facebook, yahoo, twitter and more using R" href="http://www.r-bloggers.com/?s=Web+Scraping" rel="nofollow">Web Scraping</a>) statistics (<a title="Regressions and ANOVA analysis tutorials" href="http://www.r-bloggers.com/?s=regression" rel="nofollow">regression</a>, <a title="principal component analysis tutorial" href="http://www.r-bloggers.com/?s=PCA" rel="nofollow">PCA</a>, <a title="Time series" href="http://www.r-bloggers.com/?s=time+series" rel="nofollow">time series</a>, <a title="finance trading" href="http://www.r-bloggers.com/?s=trading" rel="nofollow">trading</a>) and more...
</div></p>]]></content:encoded>
			<wfw:commentRss>http://www.r-bloggers.com/r-gis-terrain-analysis-for-polygons-as-simple-as-it-gets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="" length="" type="" />
		</item>
	</channel>
</rss>
