Skip to content

Commit

Permalink
Updated vignette file with new style
Browse files Browse the repository at this point in the history
  • Loading branch information
lwjohnst86 committed Jul 29, 2016
1 parent 54f8de9 commit 4112125
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 39 deletions.
5 changes: 2 additions & 3 deletions vignettes/file_structure.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@
├── doc
│   └── manuscript.Rmd
├── vignettes
│   ├── extra-analyses.Rmd
│   └── file_structure.txt
│   └── extra-analyses.Rmd
├── .Rbuildignore
├── .gitignore
├── DESCRIPTION
├── ManuscriptName.Rproj
├── NAMESPACE
└── README.md

3 directories, 13 files
3 directories, 12 files
17 changes: 11 additions & 6 deletions vignettes/introduction.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ knitr::opts_chunk$set(
eval = FALSE
)

## ----templates, collapse=TRUE--------------------------------------------
# library(prodigenr)
# template_list
# path <- tempdir()
## ----templates, collapse=TRUE, eval=TRUE---------------------------------
library(prodigenr)
path <- tempdir()
template_list

## ----manuscriptProj------------------------------------------------------
# prodigen('manuscript', 'ManuscriptName', path, git.init = TRUE)

## ----shell_command, echo = FALSE-----------------------------------------
## ----shell_command, echo=FALSE-------------------------------------------
# # run only on computer
# cat(paste(system(
# paste0('cd ', path, '/ManuscriptName && tree -a -I .git --dirsfirst -v'),
Expand All @@ -22,10 +22,15 @@ knitr::opts_chunk$set(
# file = 'vignettes/file_structure.txt')
# unlink(file.path(path, 'ManuscriptName'), recursive = TRUE)

## ----file_structure, eval = TRUE, echo = FALSE, results='markup', comment=''----
## ----file_structure, echo=FALSE, eval=TRUE, results='markup', comment=''----
cat(readLines('file_structure.txt', warn = FALSE), sep = '\n')

## ---- eval=FALSE---------------------------------------------------------
# prodigen('slides', 'PresentationName', '~/path')
# prodigen('abstract', 'Name', '.') # Current directory

## ------------------------------------------------------------------------
# prodigenr::include_rfigshare_script()
# prodigenr::include_mit_license()
# prodigenr::include_strobe()

61 changes: 43 additions & 18 deletions vignettes/introduction.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ mind!
`prodigenr`, or *pro*ject *di*rectory *gen*erator, simplifies the process of
creating these new projects and can help make your workflow more reproducible.
Standard files and folders are created for specific projects (e.g. abstracts or
manuscripts), along with a workflow that tries to be simple and easy to use.
manuscripts), along with a workflow that tries to be simple and easy to use,
while making use of the infrastructure and processes already well-developed and
maintained (e.g. RStudio and devtools).

Because researchers often write or create many papers, slides, posters, and
abstracts, it can quickly become tedious and messy to always make a new
Expand All @@ -37,10 +39,10 @@ directory with all the necessary files and organization.
To use `prodigenr`, you simply need to use the `prodigen` command. At present,
there are only four template projects that you can view using:

```{r templates, collapse=TRUE}
```{r templates, collapse=TRUE, eval=TRUE}
library(prodigenr)
template_list
path <- tempdir()
template_list
```

These templates are projects that an academic researcher typically encounters.
Expand All @@ -53,7 +55,7 @@ Starting a manuscript? Create a project directory like so (using [Git](https://g
prodigen('manuscript', 'ManuscriptName', path, git.init = TRUE)
```

```{r shell_command, echo = FALSE}
```{r shell_command, echo=FALSE}
# run only on computer
cat(paste(system(
paste0('cd ', path, '/ManuscriptName && tree -a -I .git --dirsfirst -v'),
Expand All @@ -65,7 +67,7 @@ unlink(file.path(path, 'ManuscriptName'), recursive = TRUE)

The resulting file structure should look something like this:

```{r file_structure, eval = TRUE, echo = FALSE, results='markup', comment=''}
```{r file_structure, echo=FALSE, eval=TRUE, results='markup', comment=''}
cat(readLines('file_structure.txt', warn = FALSE), sep = '\n')
```

Expand All @@ -86,22 +88,48 @@ reviewers ask for something or want to confirm your results. For more
information on good practices to use in making an analysis project, see
[here](http://stats.stackexchange.com/questions/2910/how-to-efficiently-manage-a-statistical-analysis-project)
or
[here](http://www.r-bloggers.com/managing-a-statistical-analysis-project-%E2%80%93-guidelines-and-best-practices/))
[here](http://www.r-bloggers.com/managing-a-statistical-analysis-project-%E2%80%93-guidelines-and-best-practices/)

In addition to the main `prodigen()` function, there are several `include_*()`
style functions available to add other, maybe less common, files. So far
there are:

- `include_rfigshare_script()` to send portions (or all) of your code to
[figshare](https://figshare.com/) for others to confirm or use your code and
analysis workflow.
- `include_mit_license()` to add a MIT license to your code, so that you
explicitly allow others to re-use your code without legal issues coming up.
Works well in conjunction with the above function.
- `include_strobe()` to add a STROBE checklist. This is very specific to
epidemiological research (which I do), so not all users will need this.

You can use them by opening up the new project `.Rproj` (RStudio) file and run
them in the console as:

```{r}
prodigenr::include_rfigshare_script()
prodigenr::include_mit_license()
prodigenr::include_strobe()
```

## Workflow when using projects created from `prodigenr`

A typical workflow would be to:
A typical workflow, which is also outlined in the README.md of the created
project, would be to:

1. Write up your analysis and associated written explanations of the results, as
you would for any research project, in the abstract, poster, slides, or
manuscript `.Rmd` ([R Markdown](http://rmarkdown.rstudio.com/)) file.
manuscript `.Rmd` ([R Markdown](http://rmarkdown.rstudio.com/)) file in the
`doc/` folder.
2. Any piece of code you use more than once or is fairly complex, convert it
into a function. Put this new function into the `R/` directory. Load that function
using `devtools::load_all()` (Ctrl-Shift-L).
into a function. Put this new function into a file (or the `functions.R` file) the
`R/` directory. Load that function using `devtools::load_all()` (Ctrl-Shift-L).
3. Fetch and wrangle your data in the `R/fetch_data.R` and to use the data, load
it using `load_data()`.
4. Knit the `.Rmd` file. You now have your final abstract, poster, slides, or
manuscript to use for your research.
4. Use the Rmd files in the `vignettes/` folder to add analyses that will
supplement the main document, but aren't necessary to be included.
5. Knit the `.Rmd` file in `doc/`. You now have your final abstract, poster,
slides, or manuscript to use for your research.

## Related packages or projects

Expand All @@ -123,11 +151,8 @@ compared to `ProjectTemplate` in this
[blog](https://rmflight.github.io/posts/2014/07/zpackages_vs_projectTemplate.html)).

There is also a list of other similar projects
[on the rOpenSci GitHub repository](https://github.com/ropensci/rrrpkg#useful-tools-and-templates-for-making-research-compendia).
[on the rOpenSci GitHub repository](https://github.com/ropensci/rrrpkg#useful-tools-and-templates-for-making-research-compendia).
It's up to you to decide which style to use.

It's up to you to decide which style to use. The goal behind creating
`prodigenr` was to incorporate the ideas behind R packages and mesh well with
RStudio, while also trying to be as simple as possible so it is in some ways a
hybrid between `ProjectTemplate` and `makeProject`. It can always be improved,
so if you have suggestions just submit a
If you have ideas to improve prodigenr, just submit a
[GitHub issue](https://github.com/lwjohnst86/prodigenr/issues)!
35 changes: 23 additions & 12 deletions vignettes/introduction.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,15 @@ <h4 class="date"><em>2016-07-28</em></h4>


<p>Are you an academic researcher who often writes up abstracts for conferences or submits manuscripts to journals? Do you often have to make slides or posters for presentations? Is your usual workflow to copy a previous project and start replacing the old text for the new text? This R package was designed with you in mind!</p>
<p><code>prodigenr</code>, or <em>pro</em>ject <em>di</em>rectory <em>gen</em>erator, simplifies the process of creating these new projects and can help make your workflow more reproducible. Standard files and folders are created for specific projects (e.g. abstracts or manuscripts), along with a workflow that tries to be simple and easy to use.</p>
<p><code>prodigenr</code>, or <em>pro</em>ject <em>di</em>rectory <em>gen</em>erator, simplifies the process of creating these new projects and can help make your workflow more reproducible. Standard files and folders are created for specific projects (e.g. abstracts or manuscripts), along with a workflow that tries to be simple and easy to use, while making use of the infrastructure and processes already well-developed and maintained (e.g. RStudio and devtools).</p>
<p>Because researchers often write or create many papers, slides, posters, and abstracts, it can quickly become tedious and messy to always make a new directory with all the necessary files and organization.</p>
<div id="the-main-command-prodigen" class="section level2">
<h2>The main command: <code>prodigen</code></h2>
<p>To use <code>prodigenr</code>, you simply need to use the <code>prodigen</code> command. At present, there are only four template projects that you can view using:</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">library</span>(prodigenr)
path &lt;-<span class="st"> </span><span class="kw">tempdir</span>()
template_list
path &lt;-<span class="st"> </span><span class="kw">tempdir</span>()</code></pre></div>
<span class="co">#&gt; [1] &quot;abstract&quot; &quot;manuscript&quot; &quot;poster&quot; &quot;slides&quot;</span></code></pre></div>
<p>These templates are projects that an academic researcher typically encounters. However, if you have a suggestion or want to add a template, please create a <a href="https://github.com/lwjohnst86/prodigenr/issues">Github issue</a> or submit a <a href="https://github.com/lwjohnst86/prodigenr/pulls">Pull Request</a>!</p>
<p>Starting a manuscript? Create a project directory like so (using <a href="https://git-scm.com/">Git</a>):</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">prodigen</span>(<span class="st">'manuscript'</span>, <span class="st">'ManuscriptName'</span>, path, <span class="dt">git.init =</span> <span class="ot">TRUE</span>)</code></pre></div>
Expand All @@ -96,30 +97,40 @@ <h2>The main command: <code>prodigen</code></h2>
├── doc
│   └── manuscript.Rmd
├── vignettes
│   ├── extra-analyses.Rmd
│   └── file_structure.txt
│   └── extra-analyses.Rmd
├── .Rbuildignore
├── .gitignore
├── DESCRIPTION
├── ManuscriptName.Rproj
├── NAMESPACE
└── README.md

3 directories, 13 files</code></pre>
3 directories, 12 files</code></pre>
<p>The same procedure is used for making the other project templates.</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">prodigen</span>(<span class="st">'slides'</span>, <span class="st">'PresentationName'</span>, <span class="st">'~/path'</span>)
<span class="kw">prodigen</span>(<span class="st">'abstract'</span>, <span class="st">'Name'</span>, <span class="st">'.'</span>) <span class="co"># Current directory</span></code></pre></div>
<p>A <code>README.md</code> file is contained within each project that explains more about what each folder does and what some of the files do that were created.</p>
<p>The end goal of each project is to be as self contained as possible. So that if you ever need to go back to the analysis, it is easy to re-run the code and get the results that you say you got. This is especially useful if others such as reviewers ask for something or want to confirm your results. For more information on good practices to use in making an analysis project, see <a href="http://stats.stackexchange.com/questions/2910/how-to-efficiently-manage-a-statistical-analysis-project">here</a> or <a href="http://www.r-bloggers.com/managing-a-statistical-analysis-project-%E2%80%93-guidelines-and-best-practices/">here</a>)</p>
<p>The end goal of each project is to be as self contained as possible. So that if you ever need to go back to the analysis, it is easy to re-run the code and get the results that you say you got. This is especially useful if others such as reviewers ask for something or want to confirm your results. For more information on good practices to use in making an analysis project, see <a href="http://stats.stackexchange.com/questions/2910/how-to-efficiently-manage-a-statistical-analysis-project">here</a> or <a href="http://www.r-bloggers.com/managing-a-statistical-analysis-project-%E2%80%93-guidelines-and-best-practices/">here</a></p>
<p>In addition to the main <code>prodigen()</code> function, there are several <code>include_*()</code> style functions available to add other, maybe less common, files. So far there are:</p>
<ul>
<li><code>include_rfigshare_script()</code> to send portions (or all) of your code to <a href="https://figshare.com/">figshare</a> for others to confirm or use your code and analysis workflow.</li>
<li><code>include_mit_license()</code> to add a MIT license to your code, so that you explicitly allow others to re-use your code without legal issues coming up. Works well in conjunction with the above function.</li>
<li><code>include_strobe()</code> to add a STROBE checklist. This is very specific to epidemiological research (which I do), so not all users will need this.</li>
</ul>
<p>You can use them by opening up the new project <code>.Rproj</code> (RStudio) file and run them in the console as:</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">prodigenr::<span class="kw">include_rfigshare_script</span>()
prodigenr::<span class="kw">include_mit_license</span>()
prodigenr::<span class="kw">include_strobe</span>()</code></pre></div>
</div>
<div id="workflow-when-using-projects-created-from-prodigenr" class="section level2">
<h2>Workflow when using projects created from <code>prodigenr</code></h2>
<p>A typical workflow would be to:</p>
<p>A typical workflow, which is also outlined in the README.md of the created project, would be to:</p>
<ol style="list-style-type: decimal">
<li>Write up your analysis and associated written explanations of the results, as you would for any research project, in the abstract, poster, slides, or manuscript <code>.Rmd</code> (<a href="http://rmarkdown.rstudio.com/">R Markdown</a>) file.</li>
<li>Any piece of code you use more than once or is fairly complex, convert it into a function. Put this new function into the <code>R/</code> directory. Load that function using <code>devtools::load_all()</code> (Ctrl-Shift-L).</li>
<li>Write up your analysis and associated written explanations of the results, as you would for any research project, in the abstract, poster, slides, or manuscript <code>.Rmd</code> (<a href="http://rmarkdown.rstudio.com/">R Markdown</a>) file in the <code>doc/</code> folder.</li>
<li>Any piece of code you use more than once or is fairly complex, convert it into a function. Put this new function into a file (or the <code>functions.R</code> file) the <code>R/</code> directory. Load that function using <code>devtools::load_all()</code> (Ctrl-Shift-L).</li>
<li>Fetch and wrangle your data in the <code>R/fetch_data.R</code> and to use the data, load it using <code>load_data()</code>.</li>
<li>Knit the <code>.Rmd</code> file. You now have your final abstract, poster, slides, or manuscript to use for your research.</li>
<li>Use the Rmd files in the <code>vignettes/</code> folder to add analyses that will supplement the main document, but aren’t necessary to be included.</li>
<li>Knit the <code>.Rmd</code> file in <code>doc/</code>. You now have your final abstract, poster, slides, or manuscript to use for your research.</li>
</ol>
</div>
<div id="related-packages-or-projects" class="section level2">
Expand All @@ -130,8 +141,8 @@ <h2>Related packages or projects</h2>
<li><a href="https://cran.r-project.org/package=makeProject"><code>makeProject</code></a> is very simple and stripped down in what it creates and in it’s use. Downside is that it wasn’t updated since 2012.</li>
<li>Use of the R package structure via <a href="https://cran.r-project.org/package=devtools"><code>devtools</code></a>, which is argued for in this <a href="https://rmflight.github.io/posts/2014/07/vignetteAnalysis.html">blog</a> and compared to <code>ProjectTemplate</code> in this <a href="https://rmflight.github.io/posts/2014/07/zpackages_vs_projectTemplate.html">blog</a>).</li>
</ul>
<p>There is also a list of other similar projects <a href="https://github.com/ropensci/rrrpkg#useful-tools-and-templates-for-making-research-compendia">on the rOpenSci GitHub repository</a>.</p>
<p>It’s up to you to decide which style to use. The goal behind creating <code>prodigenr</code> was to incorporate the ideas behind R packages and mesh well with RStudio, while also trying to be as simple as possible so it is in some ways a hybrid between <code>ProjectTemplate</code> and <code>makeProject</code>. It can always be improved, so if you have suggestions just submit a <a href="https://github.com/lwjohnst86/prodigenr/issues">GitHub issue</a>!</p>
<p>There is also a list of other similar projects <a href="https://github.com/ropensci/rrrpkg#useful-tools-and-templates-for-making-research-compendia">on the rOpenSci GitHub repository</a>. It’s up to you to decide which style to use.</p>
<p>If you have ideas to improve prodigenr, just submit a <a href="https://github.com/lwjohnst86/prodigenr/issues">GitHub issue</a>!</p>
</div>


Expand Down

0 comments on commit 4112125

Please sign in to comment.