Skip to content

fhi-beta/best_practices_files

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

<!DOCTYPE html>
<html >

<head>

  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>Dashboards project</title>
  <meta name="description" content="A guide to authoring books with R Markdown, including how to generate figures and tables, and insert cross-references, citations, HTML widgets, and Shiny apps in R Markdown. The book can be exported to HTML, PDF, and e-books (e.g. EPUB). The book style is customizable. You can easily write and preview the book in RStudio IDE or other editors, and host the book wherever you want (e.g. bookdown.org).">
  <meta name="generator" content="bookdown  and GitBook 2.6.7">

  <meta property="og:title" content="Dashboards project" />
  <meta property="og:type" content="book" />
  <meta property="og:url" content="https://folkehelseinstituttet.github.io/dashboards/" />
  <meta property="og:image" content="https://folkehelseinstituttet.github.io/dashboards/images/fhi.svg" />
  <meta property="og:description" content="A guide to authoring books with R Markdown, including how to generate figures and tables, and insert cross-references, citations, HTML widgets, and Shiny apps in R Markdown. The book can be exported to HTML, PDF, and e-books (e.g. EPUB). The book style is customizable. You can easily write and preview the book in RStudio IDE or other editors, and host the book wherever you want (e.g. bookdown.org)." />
  <meta name="github-repo" content="folkehelseinstituttet/dashboards" />

  <meta name="twitter:card" content="summary" />
  <meta name="twitter:title" content="Dashboards project" />
  
  <meta name="twitter:description" content="A guide to authoring books with R Markdown, including how to generate figures and tables, and insert cross-references, citations, HTML widgets, and Shiny apps in R Markdown. The book can be exported to HTML, PDF, and e-books (e.g. EPUB). The book style is customizable. You can easily write and preview the book in RStudio IDE or other editors, and host the book wherever you want (e.g. bookdown.org)." />
  <meta name="twitter:image" content="https://folkehelseinstituttet.github.io/dashboards/images/fhi.svg" />

<meta name="author" content="Richard White">


<meta name="date" content="2018-10-31">

  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
  
  
<link rel="prev" href="umbrella-infrastructure.html">

<script src="libs/jquery-2.2.3/jquery.min.js"></script>
<link href="libs/gitbook-2.6.7/css/style.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-table.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-bookdown.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-highlight.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-search.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-fontsettings.css" rel="stylesheet" />










<link rel="stylesheet" href="css/style.css" type="text/css" />
</head>

<body>



  <div class="book without-animation with-summary font-size-2 font-family-1" data-basepath=".">

    <div class="book-summary">
      <nav role="navigation">

<ul class="summary">
<li><a href="./">Dashboards</a></li>

<li class="divider"></li>
<li class="chapter" data-level="" data-path="index.html"><a href="index.html"><i class="fa fa-check"></i>Preface</a></li>
<li class="chapter" data-level="1" data-path="introduction.html"><a href="introduction.html"><i class="fa fa-check"></i><b>1</b> Introduction</a><ul>
<li class="chapter" data-level="1.1" data-path="introduction.html"><a href="introduction.html#executive-summary"><i class="fa fa-check"></i><b>1.1</b> Executive summary</a></li>
<li class="chapter" data-level="1.2" data-path="introduction.html"><a href="introduction.html#what-is-an-automated-analysis"><i class="fa fa-check"></i><b>1.2</b> What is an automated analysis?</a></li>
<li class="chapter" data-level="1.3" data-path="introduction.html"><a href="introduction.html#why-not-have-one-project-for-each-automated-analysis"><i class="fa fa-check"></i><b>1.3</b> Why not have one project for each automated analysis?</a></li>
<li class="chapter" data-level="1.4" data-path="introduction.html"><a href="introduction.html#important-repositories"><i class="fa fa-check"></i><b>1.4</b> Important repositories</a><ul>
<li class="chapter" data-level="1.4.1" data-path="introduction.html"><a href="introduction.html#infrastructure"><i class="fa fa-check"></i><b>1.4.1</b> Infrastructure</a></li>
<li class="chapter" data-level="1.4.2" data-path="introduction.html"><a href="introduction.html#automated-analyses-r-packages"><i class="fa fa-check"></i><b>1.4.2</b> Automated analyses R packages</a></li>
</ul></li>
</ul></li>
<li class="chapter" data-level="2" data-path="integrating-the-r-package-into-the-physical-system.html"><a href="integrating-the-r-package-into-the-physical-system.html"><i class="fa fa-check"></i><b>2</b> Integrating the R package into the physical system</a><ul>
<li class="chapter" data-level="2.1" data-path="integrating-the-r-package-into-the-physical-system.html"><a href="integrating-the-r-package-into-the-physical-system.html#summary"><i class="fa fa-check"></i><b>2.1</b> Summary</a></li>
<li class="chapter" data-level="2.2" data-path="integrating-the-r-package-into-the-physical-system.html"><a href="integrating-the-r-package-into-the-physical-system.html#runprocess.r"><i class="fa fa-check"></i><b>2.2</b> RunProcess.R</a><ul>
<li class="chapter" data-level="2.2.1" data-path="integrating-the-r-package-into-the-physical-system.html"><a href="integrating-the-r-package-into-the-physical-system.html#aim"><i class="fa fa-check"></i><b>2.2.1</b> Aim</a></li>
<li class="chapter" data-level="2.2.2" data-path="integrating-the-r-package-into-the-physical-system.html"><a href="integrating-the-r-package-into-the-physical-system.html#bounded-context"><i class="fa fa-check"></i><b>2.2.2</b> Bounded context</a></li>
</ul></li>
<li class="chapter" data-level="2.3" data-path="integrating-the-r-package-into-the-physical-system.html"><a href="integrating-the-r-package-into-the-physical-system.html#run.sh"><i class="fa fa-check"></i><b>2.3</b> 0_run.sh</a><ul>
<li class="chapter" data-level="2.3.1" data-path="integrating-the-r-package-into-the-physical-system.html"><a href="integrating-the-r-package-into-the-physical-system.html#aim-1"><i class="fa fa-check"></i><b>2.3.1</b> Aim</a></li>
</ul></li>
<li class="chapter" data-level="2.4" data-path="integrating-the-r-package-into-the-physical-system.html"><a href="integrating-the-r-package-into-the-physical-system.html#runtest.r"><i class="fa fa-check"></i><b>2.4</b> RunTest.R</a><ul>
<li class="chapter" data-level="2.4.1" data-path="integrating-the-r-package-into-the-physical-system.html"><a href="integrating-the-r-package-into-the-physical-system.html#aim-2"><i class="fa fa-check"></i><b>2.4.1</b> Aim</a></li>
</ul></li>
</ul></li>
<li class="chapter" data-level="3" data-path="r-packages.html"><a href="r-packages.html"><i class="fa fa-check"></i><b>3</b> R packages</a><ul>
<li class="chapter" data-level="3.1" data-path="r-packages.html"><a href="r-packages.html#summary-1"><i class="fa fa-check"></i><b>3.1</b> Summary</a></li>
<li class="chapter" data-level="3.2" data-path="r-packages.html"><a href="r-packages.html#requirements"><i class="fa fa-check"></i><b>3.2</b> Requirements</a></li>
<li class="chapter" data-level="3.3" data-path="r-packages.html"><a href="r-packages.html#deployment-via-travis-ci-and-drat"><i class="fa fa-check"></i><b>3.3</b> Deployment via travis-ci and drat</a></li>
</ul></li>
<li class="chapter" data-level="4" data-path="umbrella-infrastructure.html"><a href="umbrella-infrastructure.html"><i class="fa fa-check"></i><b>4</b> Umbrella Infrastructure</a><ul>
<li class="chapter" data-level="4.1" data-path="umbrella-infrastructure.html"><a href="umbrella-infrastructure.html#executive-summary-1"><i class="fa fa-check"></i><b>4.1</b> Executive summary</a></li>
<li class="chapter" data-level="4.2" data-path="umbrella-infrastructure.html"><a href="umbrella-infrastructure.html#what-is-an-automated-analysis-1"><i class="fa fa-check"></i><b>4.2</b> What is an automated analysis?</a></li>
<li class="chapter" data-level="4.3" data-path="umbrella-infrastructure.html"><a href="umbrella-infrastructure.html#why-not-have-one-project-for-each-automated-analysis-1"><i class="fa fa-check"></i><b>4.3</b> Why not have one project for each automated analysis?</a></li>
</ul></li>
<li class="chapter" data-level="5" data-path="contributing.html"><a href="contributing.html"><i class="fa fa-check"></i><b>5</b> Contributing</a><ul>
<li class="chapter" data-level="5.1" data-path="contributing.html"><a href="contributing.html#development-guidelines"><i class="fa fa-check"></i><b>5.1</b> Development guidelines</a></li>
<li class="chapter" data-level="5.2" data-path="contributing.html"><a href="contributing.html#code-style"><i class="fa fa-check"></i><b>5.2</b> Code style</a></li>
</ul></li>
<li class="divider"></li>
<li><a href="https://www.fhi.no/" target="blank">www.fhi.no</a></li>

</ul>

      </nav>
    </div>

    <div class="book-body">
      <div class="body-inner">
        <div class="book-header" role="navigation">
          <h1>
            <i class="fa fa-circle-o-notch fa-spin"></i><a href="./">Dashboards project</a>
          </h1>
        </div>

        <div class="page-wrapper" tabindex="-1" role="main">
          <div class="page-inner">

            <section class="normal" id="section-">
<div id="contributing" class="section level1">
<h1><span class="header-section-number">5</span> Contributing</h1>
<div id="development-guidelines" class="section level2">
<h2><span class="header-section-number">5.1</span> Development guidelines</h2>
<p>We try to follow the <a href="https://guides.github.com/introduction/flow/">GitHub flow</a> for development.</p>
<ol style="list-style-type: decimal">
<li>Fork [this repo][repo] and clone it to your computer. To learn more about this process, see <a href="https://guides.github.com/activities/forking/">this guide</a>.</li>
<li><p>Add the Folkehelseinstituttet repository as your upstream:</p>
<pre><code>git remote add upstream https://github.com/folkehelseinstituttet/ORIGINAL_REPOSITORY.git</code></pre></li>
<li><p>If you have forked and cloned the project before and it has been a while since you worked on it, merge changes from the original repo to your clone by using:</p>
<pre><code>git fetch upstream
git merge upstream/master</code></pre></li>
<li>Open the RStudio project file (<code>.Rproj</code>).</li>
<li>Make your changes:
<ul>
<li>Write your code.</li>
<li>Test your code (bonus points for adding unit tests).</li>
<li>Document your code (see function documentation above).</li>
<li>Do an <code>R CMD check</code> using <code>devtools::check()</code> and aim for 0 errors and warnings.</li>
<li>Commit your changes locally</li>
<li>Merge changes from the original repo (again)</li>
<li>Do an <code>R CMD check</code> using <code>devtools::check()</code> and aim for 0 errors and warnings.</li>
</ul></li>
<li>Commit and push your changes.</li>
<li>Submit a <a href="https://guides.github.com/activities/forking/#making-a-pull-request">pull request</a>.</li>
<li><p>If you are reviewing the pull request, wait until the <a href="www.travis-ci.org">travis-ci</a> unit tests have finished</p></li>
</ol>
<p><img src="images/pull_request_before_checks.png" /><!-- --></p>
<ol start="9" style="list-style-type: decimal">
<li>Please make sure that the unit tests <code>PASS</code> before merging in!!</li>
</ol>
<p><img src="images/pull_request_checks_failed.png" /><!-- --></p>
</div>
<div id="code-style" class="section level2">
<h2><span class="header-section-number">5.2</span> Code style</h2>
<ul>
<li>Function names start with capital letters</li>
<li>Variable names start with small letters</li>
<li>Environments should be in ALL CAPS</li>
<li>Reference <a href="http://adv-r.had.co.nz/Style.html">Hadley’s style code</a></li>
<li>&lt;- is preferred over = for assignment</li>
<li>Indentation is with two spaces, not two or a tab. There should be no tabs in code files.</li>
<li>if () {} else {} constructions should always use full curly braces even when usage seems unnecessary from a clarity perspective.</li>
<li>TODO statements should be opened as GitHub issues with links to specific code files and code lines, rather than written inline.</li>
<li><p>Follow Hadley’s suggestion for aligning long functions with many arguments:</p>
<pre><code> long_function_name &lt;- function(a = &quot;a long argument&quot;, 
                            b = &quot;another argument&quot;,
                            c = &quot;another long argument&quot;) {
   # As usual code is indented by two spaces.
 }</code></pre></li>
<li>Never use print() to send text to the console. Instead use message(), warning(), and error() as appropriate.</li>
<li><p>Use environment variables, not options(), to store global arguments that are used by many or all functions.</p></li>
</ul>

</div>
</div>
            </section>

          </div>
        </div>
      </div>
<a href="umbrella-infrastructure.html" class="navigation navigation-prev navigation-unique" aria-label="Previous page"><i class="fa fa-angle-left"></i></a>

    </div>
  </div>
<script src="libs/gitbook-2.6.7/js/app.min.js"></script>
<script src="libs/gitbook-2.6.7/js/lunr.js"></script>
<script src="libs/gitbook-2.6.7/js/plugin-search.js"></script>
<script src="libs/gitbook-2.6.7/js/plugin-sharing.js"></script>
<script src="libs/gitbook-2.6.7/js/plugin-fontsettings.js"></script>
<script src="libs/gitbook-2.6.7/js/plugin-bookdown.js"></script>
<script src="libs/gitbook-2.6.7/js/jquery.highlight.js"></script>
<script>
gitbook.require(["gitbook"], function(gitbook) {
gitbook.start({
"sharing": {
"github": false,
"facebook": true,
"twitter": true,
"google": false,
"linkedin": false,
"weibo": false,
"instapper": false,
"vk": false,
"all": ["facebook", "google", "twitter", "linkedin", "weibo", "instapaper"]
},
"fontsettings": {
"theme": "white",
"family": "sans",
"size": 2
},
"edit": {
"link": null,
"text": null
},
"download": ["website.pdf", "website.epub"],
"toc": {
"collapse": "section"
}
});
});
</script>

</body>

</html>

About

No description, website, or topics provided.

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published