<p><div><div><div><div data-width="100" data-show-faces="false" data-send="true" data-layout="button_count" data-height="21" data-href="https://www.r-bloggers.com/analyzing-data-on-cran-packages/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="http://blog.revolutionanalytics.com/2017/05/analyzing-data-on-cran-packages.html"> Revolutions</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<div>
<p>There's a handy new function in R 3.4.0 for anyone interested in data about CRAN packages. It's not documented, but it's pretty simple:</p>
<pre><code data-lang="r"><span>tools</span><span>::</span><span>CRAN_package_db</span><span>()</span></code></pre>
<p>returns a data frame with one row for every package on CRAN and 65 columns of data on those packages, as shown below.</p>
<pre>> names(tools::CRAN_package_db())
 [1] &quot;Package&quot;                 &quot;Version&quot;                 &quot;Priority&quot;               
 [4] &quot;Depends&quot;                 &quot;Imports&quot;                 &quot;LinkingTo&quot;              
 [7] &quot;Suggests&quot;                &quot;Enhances&quot;                &quot;License&quot;                
[10] &quot;License_is_FOSS&quot;         &quot;License_restricts_use&quot;   &quot;OS_type&quot;                
[13] &quot;Archs&quot;                   &quot;MD5sum&quot;                  &quot;NeedsCompilation&quot;       
[16] &quot;Additional_repositories&quot; &quot;Author&quot;                  &quot;Authors@R&quot;              
[19] &quot;Biarch&quot;                  &quot;BugReports&quot;              &quot;BuildKeepEmpty&quot;         
[22] &quot;BuildManual&quot;             &quot;BuildResaveData&quot;         &quot;BuildVignettes&quot;         
[25] &quot;Built&quot;                   &quot;ByteCompile&quot;             &quot;Classification/ACM&quot;     
[28] &quot;Classification/ACM-2012&quot; &quot;Classification/JEL&quot;      &quot;Classification/MSC&quot;     
[31] &quot;Classification/MSC-2010&quot; &quot;Collate&quot;                 &quot;Collate.unix&quot;           
[34] &quot;Collate.windows&quot;         &quot;Contact&quot;                 &quot;Copyright&quot;              
[37] &quot;Date&quot;                    &quot;Description&quot;             &quot;Encoding&quot;               
[40] &quot;KeepSource&quot;              &quot;Language&quot;                &quot;LazyData&quot;               
[43] &quot;LazyDataCompression&quot;     &quot;LazyLoad&quot;                &quot;MailingList&quot;            
[46] &quot;Maintainer&quot;              &quot;Note&quot;                    &quot;Packaged&quot;               
[49] &quot;RdMacros&quot;                &quot;SysDataCompression&quot;      &quot;SystemRequirements&quot;     
[52] &quot;Title&quot;                   &quot;Type&quot;                    &quot;URL&quot;                    
[55] &quot;VignetteBuilder&quot;         &quot;ZipData&quot;                 &quot;Published&quot;              
[58] &quot;Path&quot;                    &quot;X-CRAN-Comment&quot;          &quot;Reverse depends&quot;        
[61] &quot;Reverse imports&quot;         &quot;Reverse linking to&quot;      &quot;Reverse suggests&quot;       
[64] &quot;Reverse enhances&quot;        &quot;MD5sum&quot;   
</pre>
<p>In a recent blog post, <a target="_blank" rel="nofollow" href="http://juliasilge.com/blog/Mining-CRAN-DESCRIPTION/">Julia Silge analyzes this database</a> to find out some interesting statistics on CRAN packages. For example, by mining the Description field of the packages, we can see which words (other than stopwords like &quot;the&quot; and &quot;and&quot;) are most commonly used. Unsurprisingly, most are associated with data and data analysis methods:</p>
<p><a target="_blank" rel="nofollow" href="http://juliasilge.com/blog/Mining-CRAN-DESCRIPTION/"><img title="CRAN-common_words" alt="CRAN-common_words" src="http://revolution-computing.typepad.com/.a/6a010534b1db25970b01b7c8f74441970b-800wi" border="0"></a></p>
<p>Julia also analysed which packages include tests (via the <a target="_blank" rel="nofollow" href="https://github.com/hadley/testthat">testthat</a> or <a target="_blank" rel="nofollow" href="https://mran.microsoft.com/package/RUnit/">RUnit</a> packages), or provide a link for providing bug reports, or provide vignettes (dynamically-created documentation). By this analysis, more than 60% of packages provide none of these:</p>
<p><a target="_blank" rel="nofollow" href="http://revolution-computing.typepad.com/.a/6a010534b1db25970b01bb099a61c8970d-pi"><img title="CRAN-practices" alt="CRAN-practices" src="http://revolution-computing.typepad.com/.a/6a010534b1db25970b01bb099a61c8970d-800wi" border="0"></a></p>
<p>This is a bit of an underestimate though, as many packages (especially older packages) do include a <a target="_blank" rel="nofollow" href="https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Checking-packages">tests folder</a> that doesn't rely on those packages, but it's not apparent how to identify those packages from the data. Tests can also be included in the help files for package functions. In particular, the CRAN maintainers will reject any package that includes no tests (except those that don't require them, like data packages), so this estimate doesn't look right to me. Nonetheless, the new <code data-lang="r"><span>CRAN_package_db </span></code>function provides a useful data source for exploring the rich world of CRAN packages. You can see further examples at Julia's blog post, linked below.</p>
<p>data science ish: <a target="_blank" rel="nofollow" href="http://juliasilge.com/blog/Mining-CRAN-DESCRIPTION/">Mining CRAN DESCRIPTION Files</a></p>
</div>
<p>
<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/2017/05/analyzing-data-on-cran-packages.html"> Revolutions</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://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="https://www.r-project.org/">R</a> news and <a title="R tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/tutorial">tutorials</a> on topics such as: <a title="Data science" rel="nofollow" href="https://www.r-bloggers.com/search/data%20science">Data science</a>, <a title="Big Data" rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data">Big Data, <a title="R jobs" rel="nofollow" href="https://www.r-users.com/">R jobs</a>, visualization (<a title="ggplot and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2">ggplot2</a>, <a title="Boxplots using lattice and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/boxplot">Boxplots</a>, <a title="Maps and gis" rel="nofollow" href="https://www.r-bloggers.com/search/map">maps</a>, <a title="Animation in R" rel="nofollow" href="https://www.r-bloggers.com/search/animation">animation</a>), programming (<a title="RStudio IDE for R" rel="nofollow" href="https://www.r-bloggers.com/search/RStudio">RStudio</a>, <a title="Sweave and literate programming" rel="nofollow" href="https://www.r-bloggers.com/search/sweave">Sweave</a>, <a title="LaTeX in R" rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX">LaTeX</a>, <a title="SQL and databases" rel="nofollow" href="https://www.r-bloggers.com/search/SQL">SQL</a>, <a title="Eclipse IDE for R" rel="nofollow" href="https://www.r-bloggers.com/search/eclipse">Eclipse</a>, <a title="git and github, Version Control System" rel="nofollow" href="https://www.r-bloggers.com/search/git">git</a>, <a title="Large data in R using Hadoop" rel="nofollow" href="https://www.r-bloggers.com/search/hadoop">hadoop</a>, <a title="Web Scraping of google, facebook, yahoo, twitter and more using R" rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping">Web Scraping</a>) statistics (<a title="Regressions and ANOVA analysis tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/regression">regression</a>, <a title="principal component analysis tutorial" rel="nofollow" href="https://www.r-bloggers.com/search/PCA">PCA</a>, <a title="Time series" rel="nofollow" href="https://www.r-bloggers.com/search/time+series">time series</a>, <a title="finance trading" rel="nofollow" href="https://www.r-bloggers.com/search/trading">trading</a>) and more...
<img height="1" alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/Qknl1yY37PE"></a></div>