---
title: "myCRAN: Graph of Daily and Cumulative Downloads of your Packages"
author: Barry Zeeberg [aut, cre]
date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{myCRAN: Graph of Daily and Cumulative Downloads of your Packages}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---
<p class=MsoNormal align=center style='text-align:center'><b style='mso-bidi-font-weight:
normal'><span style='font-size:16.0pt;font-family:"Times New Roman",serif;
color:red'>myCRAN: Wrapper for Convenient Graphical Rendering of Daily and Cumulative Downloads of your Packages<o:p></o:p></span></b></p>

<p class=MsoNormal align=center style='text-align:center'><b style='mso-bidi-font-weight:
normal'><span style='font-size:16.0pt;font-family:"Times New Roman",serif'><o:p>&nbsp;</o:p></span></b></p>

<p class=MsoNormal align=center style='text-align:center'><b style='mso-bidi-font-weight:
normal'><span style='font-size:16.0pt;font-family:"Times New Roman",serif'><o:p>&nbsp;</o:p></span></b></p>

<p class=MsoNormal align=center style='text-align:center'><b style='mso-bidi-font-weight:
normal'><span style='font-size:16.0pt;font-family:"Times New Roman",serif'>Barry
Zeeberg<o:p></o:p></span></b></p>

<p class=MsoNormal align=center style='text-align:center'><b style='mso-bidi-font-weight:
normal'><span style='font-size:16.0pt;font-family:"Times New Roman",serif'>barryz2013@gmail.com<o:p></o:p></span></b></p><br>

<p class=MsoNormal style='text-align:justify'><span style='font-size:16.0pt;
font-family:"Times New Roman",serif'>This is a convenient program to plot the daily and cumulative number of downloads of your packages.
    It is designed to be slightly more convenient than the several similar programs. If you want to run this each morning,
    you do not need to keep typing in the names of your packages. Also, this combines the daily and cumulative counts in one
    run, you do not need to run separate programs to get both types of information. The cumulative plots are very useful. From the shape of the slope, you can immediately see if interest in your package is still strong, or if things are petering out.</p><br>

<p class=MsoNormal style='text-align:justify'><span style='font-size:16.0pt;
font-family:"Times New Roman",serif'>The myCRAN program is invoked by

<br>packages<-c("timeLineGraphics","textBoxPlacement","SherlockHolmes")<br>
from<-"2023-01-01"<br>
myCRAN(packages,from=from,plotNew=TRUE)<br>
myCRAN(packages,when="last-week",plotNew=FALSE)<br><br>

* *packages* character vector of names of packages.
* *from* date parameter for cran_downloads().
* *when* date parameter for cran_downloads().
* *plotNew* Boolean if TRUE start a new plot window.
* *plotWidth* integer width parameter for dev.new().<br>

<p class=MsoNormal style='text-align:justify'><span style='font-size:16.0pt;
font-family:"Times New Roman",serif'>Here are the graphical results of running these 2 invocations of myCRAN. The first and third graphs display the daily counts; the second and fourth display the cumulative counts. The cumulative total for the time frame is given next to the package name in the figure legends. </p>
    
<br><br>
![annualCount](annualCount.jpg){width=150%}

<br><br>
![annualCum](annualCum.jpg){width=150%}

<br><br>
![weeklyCount](weeklyCount.jpg){width=150%}
<br><br>
![weeklyCum](weeklyCum.jpg){width=150%}

<p class=MsoNormal align=center style='text-align:center'><b style='mso-bidi-font-weight:
normal'><span style='font-size:16.0pt;font-family:"Times New Roman",serif;
color:red'>Documentation for Enhanced Version<o:p></o:p></span></b></p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:16.0pt;
font-family:"Times New Roman",serif'>The enhanced version was invoked by</p><br>
![](Fig0.jpg){width=100%}

* *packages* character vector of names of packages.
* *from* date parameter for cran_downloads().
* *when* date parameter for cran_downloads().
* *plotNew* Boolean if TRUE start a new plot window.
* *regress* Boolean if TRUE perform linear regression for each package.
* *printout* Boolean if TRUE print out summary data for the last several days.<br>

<p class=MsoNormal style='text-align:justify'><span style='font-size:16.0pt;
font-family:"Times New Roman",serif'>The primary output is a graph of the cumulative downloads for each package. The heavy line shows the total of all packages, values shown on the right axis.</p><br>
![](Fig4.jpg){width=150%}

<p class=MsoNormal style='text-align:justify'><span style='font-size:16.0pt;
font-family:"Times New Roman",serif'>The graph for each package appears to be nearly linear. To further quantify this hypothesis, a linear regression analysis is performed for each package. In this example, the slope of 14.40 means that 14.40 downloads were performed each day.</p><br>
![](Fig3.jpg){width=125%}
<p class=MsoNormal style='text-align:justify'><span style='font-size:16.0pt;
font-family:"Times New Roman",serif'>There seem to be 2 distinct families of slopes, around 5 and around 15, These can be seen visually in the previous figure, and confirmed quantitatively by the regression analyses. My initial expectation was that there wold be a 'burst' of interest immediately after introducing a new package, and then a leveling out. But the leveling out did not happen for any package.</p><br>

<p class=MsoNormal style='text-align:justify'><span style='font-size:16.0pt;
font-family:"Times New Roman",serif'>CRAN updating of download counts is periodic and irregular and delayed by a day or two.</p><br>
![](Fig6.jpg){width=125%}


```{r setup, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
```


