<p><div><div><div><div data-width="100" data-show-faces="false" data-send="true" data-layout="button_count" data-height="21" data-href="http://www.r-bloggers.com/some-new-r-packages/"></div></div><div><a data-url="http://www.r-bloggers.com/some-new-r-packages/" data-counturl="http://www.r-bloggers.com/some-new-r-packages/" data-count="horizontal" data-text="Some New R Packages" class="twitter-share-button" data-via="rbloggers" href="https://twitter.com/share"></a></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="http://blog.revolutionanalytics.com/2016/07/some-new-r-packages.html"> Revolutions</a></strong>, and kindly contributed to <a rel="nofollow" href="http://www.r-bloggers.com/">R-bloggers)</a> </div>
<div>
<p>by Joseph Rickert</p>
<p>New R packages keep rolling into CRAN at a prodigious rate: 184 in May, 195 in June and July looks like it will continue the trend. I spent some time sorting through them and have picked out a few that that are interesting from a data science point of view.</p>
<p><a target="_blank" href="https://mran.revolutionanalytics.com/package/ANLP/">ANLP</a> provides functions for building text prediction models. It contains functions for cleaning text data, building N-grams and more. The <a target="_blank" href="https://mran.revolutionanalytics.com/web/packages/ANLP/vignettes/ANLP_Documentation.html">vignette</a> works through an example.</p>
<p><a target="_blank" href="https://mran.revolutionanalytics.com/package/fakeR/">fakeR</a> generates fake data based on a given data set. Factors are sampled from contingency tables and numerical data is sampled from a multivariate normal distribution. The method works reasonably well for small data sets producing fake data with the same correlation structure as the original data sets. The following example, uses the <span>simulate_dataset()</span> function on a subset of the mtcars data set. The correlation plots look pretty much identical.</p>
<p><span>library(fakeR)</span><br><span>library(corrplot)</span><br><span>data(mtcars)</span><br><span>df1 &lt;- mtcars[,c(1:4,6)]</span><br><span>set.seed(77)</span><br><span>df2 &lt;- as.data.frame(simulate_dataset(df1))</span><br><span>par(mfrow=c(1,2))</span><br><span>corrplot(cor(df1),method=&quot;ellipse&quot;)</span><br><span>corrplot(cor(df2),method=&quot;ellipse&quot;)</span></p>
<p><span> <a target="_blank" href="http://revolution-computing.typepad.com/.a/6a010534b1db25970b01b8d204d028970c-pi"><img title="CorPlot" alt="CorPlot" src="http://revolution-computing.typepad.com/.a/6a010534b1db25970b01b8d204d028970c-800wi" border="0"></a></span></p>
<p>Note however, that the simulated data might need some processing before being used in a model. The last row in the df2 simulated data set contains a negative value for displacement. fakeR contains functions for both time dependent and time independent variables. There is a <a target="_blank" href="https://mran.revolutionanalytics.com/web/packages/fakeR/vignettes/my-vignette.html">vignette</a>.</p>
<p><a target="_blank" href="https://mran.revolutionanalytics.com/package/heatmaply/">heatmaply</a> produces interactive heatmaps. More than just being attractive graphics these increase the already considerable value of the heatmap as an exploratory analysis tool. The following code from the package vignette shows the correlation structure of variables in the mtcars data set.</p>
<p><span>library(heatmaply)<br></span><span>heatmaply(cor(mtcars), </span><br><span> k_col = 2, k_row = 2,</span><br><span> limits = c(-1,1)) %>%</span> <br> <span>layout(margin = list(l = 40, b = 40))</span></p>
<p><iframe height="281" allowfullscreen="" width="500" src="http://blog.revolutionanalytics.com/downloads/heatmaply.html"></iframe></p>
<p><a target="_blank" href="https://mran.revolutionanalytics.com/package/mscstexta4r/">mscstexta4r</a> provides an R Client for the Microsoft Cognitive Services <a target="_blank" href="https://www.microsoft.com/cognitive-services/en-us/text-analytics/documentation">Text Analytics REST API</a>, suite of text analytics web services built with Azure Machine Learning that can be used to analyze unstructured text. The <a target="_blank" href="https://mran.revolutionanalytics.com/web/packages/mscstexta4r/vignettes/mscstext4r_vignette.html">vignette</a> explains the text processing capabilities as well as how to get going with it.</p>
<p><a target="_blank" href="https://mran.revolutionanalytics.com/package/mvtboost/">mvtboost</a> extends the GBM model to fit boosted decision trees to multivariate continuous variables. The algorithm jointly fits models with multiple outcomes over common set of predictors. According to the authors this makes it possible to: (1) chose the number of trees and shrinkage to jointly minimize prediction error in a test set over all outcomes, (2) compare tree models across outcomes, and (3) estimate the &quot;covariance explained&quot; by predictors in pairs of outcomes. For this last point, the authors explain:</p>
<p>The covariance explained matrix can then be organized in a <span><span data-mathml="&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mi&gt;p&lt;/mi&gt;&lt;mo&gt;&amp;#x00D7;&lt;/mo&gt;&lt;mi&gt;q&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;q&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;mrow class=&quot;MJX-TeXAtom-ORD&quot;&gt;&lt;mo&gt;/&lt;/mo&gt;&lt;/mrow&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/math&gt;" tabindex="0"><span><span><span>p</span><span>×</span><span>q</span><span>(</span><span>q</span><span>+</span><span>1</span><span>)</span><span><span><span>/</span></span></span><span>2</span></span></span><span>p×q(q+1)/2</span></span></span> table where <span><span data-mathml="&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mi&gt;q&lt;/mi&gt;&lt;/math&gt;" tabindex="0"><span><span><span>q</span></span></span><span>q</span></span></span> is the number of outcomes, and <span><span data-mathml="&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mi&gt;p&lt;/mi&gt;&lt;/math&gt;" tabindex="0"><span><span><span>p</span></span></span><span>p</span></span></span> is the number of predictors. Each element is the covariance explained by a predictor for any pair of outcomes. When the outcomes are standardized to unit variance, each element can be interpreted as the correlation explained in any pair of outcomes by a predictor. Like the <span><span data-mathml="&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;msup&gt;&lt;mi&gt;R&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;/math&gt;" tabindex="0"><span><span><span><span>R</span><span>2</span></span></span></span><span>R2</span></span></span> of the linear model, this decomposition is unambiguous only if the predictors are independent. Below we show the original covariance explained matrix.</p>
<p>The theory is explained in the paper &quot;<a target="_blank" href="https://arxiv.org/ftp/arxiv/papers/1511/1511.02025.pdf">Finding Structure in Data</a>&quot;. There are two vignettes: the <a target="_blank" href="https://mran.revolutionanalytics.com/web/packages/mvtboost/vignettes/mvtboost_vignette.html">mpg example</a> and the <a target="_blank" href="https://mran.revolutionanalytics.com/web/packages/mvtboost/vignettes/mvtboost_wellbeing.html">Well-being example</a>.</p>
<p>In a classification problem, label noise refers to the incorrect labeling of the training instances. The <a target="_blank" href="https://mran.revolutionanalytics.com/package/NoiseFiltersR/">NoiseFilterR</a> package presents an extensive collection label noise filtering algorithms along with impressive documentation and references for each algorithm. For example, the documentation for the Generalized Edition (GE), a similarity-based filter is organized like this:</p>
<p><a target="_blank" href="http://revolution-computing.typepad.com/.a/6a010534b1db25970b01b7c87abaf5970b-pi"><img title="GE" alt="GE" src="http://revolution-computing.typepad.com/.a/6a010534b1db25970b01b7c87abaf5970b-800wi" border="0"></a></p>
<p>The package and its <a target="_blank" href="https://mran.revolutionanalytics.com/web/packages/NoiseFiltersR/vignettes/NoiseFiltersR.pdf">vignette</a> comprise a valuable resource for machine learning.</p>
<p><a target="_blank" href="https://mran.revolutionanalytics.com/package/preprosim/">preprosim</a> describes itself as a &quot;lightweight data quality simulation for classification&quot;. It contains functions to add noise, missing values, outliers, irrelevant features and other transformations that are useful in evaluating the classification accuracy. The <a target="_blank" href="https://mran.revolutionanalytics.com/web/packages/preprosim/vignettes/preprosim.html">vignette</a> provides a small example how missing values and noise can affect accuracy.</p>
<p><a target="_blank" href="https://mran.revolutionanalytics.com/package/polmineR/">polmineR</a> provides text mining tools for the analysis of large corpora using the <a target="_blank" href="http://cwb.sourceforge.net/">IMS Open Corpus Workbench</a> (CWB) as the backend. There is a <a target="_blank" href="https://mran.revolutionanalytics.com/web/packages/polmineR/vignettes/vignette.pdf">vignette</a> to get you started.</p>
<p><a target="_blank" href="https://mran.revolutionanalytics.com/package/RFinfer/">RFinfer</a> provides functions that use the infinitesimal jackknife to generate predictions and prediction variances from random forest models. There are <a target="_blank" href="https://mran.revolutionanalytics.com/web/packages/RFinfer/vignettes/RFinfer-examples.html">Introduction</a> and <a target="_blank" href="https://mran.revolutionanalytics.com/web/packages/RFinfer/vignettes/IJ_vig.html">Jackknife</a> vignettes.</p>
<p>Finally, there are two packages I recommend installing just for the sake of sanity.</p>
<p><a target="_blank" href="https://mran.revolutionanalytics.com/package/gaussfacts/">gaussfacts</a> provides random &quot;facts&quot; about Carl Friedrich Gauss. One or two of these and you should feel fine again.</p>
<p><a target="_blank" href="https://mran.revolutionanalytics.com/package/rmsfact/">rmsfact</a> invokes random quotes from Richard M. Stallman. To be used when gaussfacts doesn't quite do it for you.</p>
</div>
<p><div><div><div><div data-width="55" data-show-faces="false" data-send="true" data-layout="box_count" data-height="62" data-href="http://www.r-bloggers.com/some-new-r-packages/"></div></div><div><a data-url="http://www.r-bloggers.com/some-new-r-packages/" data-counturl="http://www.r-bloggers.com/some-new-r-packages/" data-count="vertical" data-text="Some New R Packages" class="twitter-share-button" data-via="rbloggers" href="https://twitter.com/share"></a></div><div></div></div><div></div></div>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="http://blog.revolutionanalytics.com/2016/07/some-new-r-packages.html"> Revolutions</a></strong>.</div>
<hr>
<a rel="nofollow" href="http://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="http://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a title="The R Project for Statistical Computing" rel="nofollow" href="http://www.r-project.org/">R</a> news and <a title="R tutorials" rel="nofollow" href="http://www.r-bloggers.com/?s=tutorial">tutorials</a> on topics such as: <a title="Data science" rel="nofollow" href="http://www.r-bloggers.com/?s=data%20science">Data science</a>, <a title="Big Data" rel="nofollow" href="http://www.r-bloggers.com/?s=Big%20Data">Big Data, <a title="R jobs" rel="nofollow" href="http://www.r-users.com/">R jobs</a>, visualization (<a title="ggplot and ggplot2 tutorials" rel="nofollow" href="http://www.r-bloggers.com/?s=ggplot2">ggplot2</a>, <a title="Boxplots using lattice and ggplot2 tutorials" rel="nofollow" href="http://www.r-bloggers.com/?s=boxplot">Boxplots</a>, <a title="Maps and gis" rel="nofollow" href="http://www.r-bloggers.com/?s=map">maps</a>, <a title="Animation in R" rel="nofollow" href="http://www.r-bloggers.com/?s=animation">animation</a>), programming (<a title="RStudio IDE for R" rel="nofollow" href="http://www.r-bloggers.com/?s=RStudio">RStudio</a>, <a title="Sweave and literate programming" rel="nofollow" href="http://www.r-bloggers.com/?s=sweave">Sweave</a>, <a title="LaTeX in R" rel="nofollow" href="http://www.r-bloggers.com/?s=LaTeX">LaTeX</a>, <a title="SQL and databases" rel="nofollow" href="http://www.r-bloggers.com/?s=SQL">SQL</a>, <a title="Eclipse IDE for R" rel="nofollow" href="http://www.r-bloggers.com/?s=eclipse">Eclipse</a>, <a title="git and github, Version Control System" rel="nofollow" href="http://www.r-bloggers.com/?s=git">git</a>, <a title="Large data in R using Hadoop" rel="nofollow" href="http://www.r-bloggers.com/?s=hadoop">hadoop</a>, <a title="Web Scraping of google, facebook, yahoo, twitter and more using R" rel="nofollow" href="http://www.r-bloggers.com/?s=Web+Scraping">Web Scraping</a>) statistics (<a title="Regressions and ANOVA analysis tutorials" rel="nofollow" href="http://www.r-bloggers.com/?s=regression">regression</a>, <a title="principal component analysis tutorial" rel="nofollow" href="http://www.r-bloggers.com/?s=PCA">PCA</a>, <a title="Time series" rel="nofollow" href="http://www.r-bloggers.com/?s=time+series">time series</a>, <a title="finance trading" rel="nofollow" href="http://www.r-bloggers.com/?s=trading">trading</a>) and more...
<img height="1" alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/TH9vCCsWgRk"></a></div>