knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

devubesp

AppVeyor build status Travis build status Codecov test coverage Lifecycle: maturing CRAN status

The goal of devubesp is to automate analyses setup tasks that are otherwise performed manually. This includes setting up directories, supporting packages and projects.

Installation

You can install the development version from GitHub with the following procedure:

# install.packages("devtools")
devtools::install_github("CorradoLanera/devubesp")

Preamble

The package, de facto, provide a single function. The aim of the function `create_ubesp_analysis() is to setup all the folders' structure, with all the needed and sample files to conduct analyses at UBESP. Does not matter if they are for a thesis, a project, a simple analyses, the initial structure for the project should be the same.

The aim is to drastically reduce (up to the phisical limit of write a single line of code) the time needed to set up a well-organized and standardized structure for all the project, from the simplest to the most complex.

My first hope is to have provaided a simple and effective instrument to reduce the direct time in the preparation of any project. The second, and more relevant, hope is that all of this will be shared between the colleagues in a way to reduce also the future time to understand each other projects structure and work-flow in conducting analyses with R within the same unit.

Characteristics

The main characteristics of the resulting structure of files and folders created are:

Example of usage

The simplest example is all you need to view to learn how simple it is to be used:^[the tilda ("~"), here, expands to the home directory from the "r point-of-view", i.e. the classical home/ on Unix systems, but to the "user/documents" on windows (instead of the simple "user/").]

devubesp::create_ubesp_analysis("~/test")
# next, read and follow the instructions appering on the screen :-)

You can also include longer path to aggregate similar kynd of projects:

devubesp::create_ubesp_analysis("~/theses/cl")
devubesp::create_ubesp_analysis("~/department-analyses/cardio/xxx")
devubesp::create_ubesp_analysis("~/whatever/whatelse")

Best Practice for synchronized folders

Including a git project into a synchronized folder (e.g., OneDrive, G Drive or DropBox) can lead to issues because too many agents compete to have the control of what you can see and what is changed (e.g., git and OneDrive).

On the other side, if you develop your code using git, you do not need to have a second agent to track it! Anyway, all the part of your project, which is not under git control should be monitored and stored in the synchronized folder.

From here, the choice seems to be using two distinct folders, e.g., one under OneDrive/ for all the project's files you do not want into git (and the data, if they are protected or too big for GitHub) and one under git version control on ~/Documents/.

On the other hand, that choice can be annoying; you have to switch continuously from one folder to another during the development of your project. More important, you cannot access smoothly to folders in OneDrive you do not want to git (e.g., data/) from your R project directory directly. Anyway, copying everything twice is incredibly inefficient, at best!

A possible solution is to use symbolic links. They are simple pointers to a file or folder. To the user, they appear like shortcut links, but they are not: the former are only pointers (i.e., they are neither files nor folders), while the latter are files containing the address of their corresponding target files or folders.

Now you can:

This way, ~/Documents/yyyy-prjname/ folder will (apparently) contain all the objects into OneDrive/yyyy-prjname/, plus the R project folder. Moreover, those symlinks do not use any space in your disk, and they are safely stored and tracked by OneDrive only. On the other hand, thank symlinks, you can access them, from the R project folder smoothly using standard relative paths as they were really there, e.g., by calling here::here(../data-raw) from the project working directory!

To create symlinks you can have different ways depending of your needs and OS. Following what I find usefull to learn how to create them:

Feature request

If you need some more features, please file an issue on github.

Bug reports

If you encounter a bug, please file a reprex (minimal reproducible example) on github.

Code of Conduct

Please note that the "devubesp" project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

Attribution

Most of the underlying function used to create this package comes directly or with slightly modifications from the usethis package, by Hadley Wickham and Jennifer Bryan.

Footnotes



CorradoLanera/devubesp documentation built on May 22, 2020, 7:23 p.m.