Coder Social home page Coder Social logo

project_template's Introduction

Project

Summary

This R-project contains all the material and the scripts used to conduct the analysis.

Analysis reproducibility

To guarantee the reproducibility of the results, the whole analysis is structured within an R-project named name.Rproj that is possible to download from this repository add repository link.

The R-packagedrake is used to manage the analysis workflow and to enhance the readability and transparency of the analysis. To know more about drake consider the official Git-hub page or the user manual. Summarizing, using drake the code of the analysis is organized into different scripts. The user defines the plan of the analysis where each step in the analysis is defined trough functions. Functions can be appropriately defined to obtain desired targets (i.e., R-output with results of interests) and they are declared in another script. Subsequently, drake manages the whole analysis recognizing the dependency structure of the different targets. When any change is made to the code drake evaluates the analysis and updates the results. Using functions to define each step of the analysis allows to avoid "coping and paste" in the code, it makes debugging easier, and it facilitates the reading of the code.

Moreover, the R-package renv is used to manage the dependencies of the R-packages used in the analysis. The renv package allows to create an isolated, portable, and reproducible environment where the analyses are run. To know more about renv consider the official documentation.

Finally, git version control was used to track the changes during the analysis.

R-project structure

The R-project name.Rproj is organized into different folders. In the folder Data/, the raw datasets are stored.

In the folder R/, the R-scripts used in the analysis are stored. Using the drake package the analysis is organized into different R-scripts files:

  • Settings.R contains the setting for the R sessions, including R-packages used.
  • Plan.R contains the plan of the analysis. Where each target (i.e., R-output with results of interests) is defined through functions.
  • Function.R contains the main functions used in \texttt{Plan.R} to obtain the targets of interest.
  • Auxiliary_functions.R contains other functions used in the analysis.
  • Analysis.R is the script used to run the whole analysis.

In the folder Documents/, it is possible to find the Report of the analysis.

Run the Analysis

In order to run the analysis follow these steps:

  1. Make sure you have already the renv R-package installed in your library. If not, run the command in R or R-studio install.packages("renv")
  2. Open the R-project name by double-clicking the file name.Rproj you can find in the main directory. A new R-studio session should open and a similar message should appear in the console if renv was correctly installed:

* Project '~ <your_path>/name' loaded. [renv <version_number>]

  1. Run the line renv::restore(), renv will ask the permission to install the R-packages used in the analysis, type y and return to confirm.
  2. Open the file R/Analysis.R and run each line of the sections "Load", "Check", and "Make".
  3. Now you can access the targets with the results using the functions drake::loadd(<name_target>) and drake::readd(<name_target>).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.