Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/olivroy/reuseme
Collections of Utility Functions to Work Across Projects
https://github.com/olivroy/reuseme
dplyr eda r rstudio-project
Last synced: about 1 month ago
JSON representation
Collections of Utility Functions to Work Across Projects
- Host: GitHub
- URL: https://github.com/olivroy/reuseme
- Owner: olivroy
- License: other
- Created: 2023-06-28T13:43:58.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-08-17T18:16:54.000Z (4 months ago)
- Last Synced: 2024-08-18T07:24:07.027Z (4 months ago)
- Topics: dplyr, eda, r, rstudio-project
- Language: R
- Homepage: https://olivroy.github.io/reuseme/
- Size: 8.08 MB
- Stars: 4
- Watchers: 1
- Forks: 2
- Open Issues: 22
-
Metadata Files:
- Readme: README.Rmd
- Changelog: NEWS.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - olivroy/reuseme - Collections of Utility Functions to Work Across Projects (R)
README
---
output: github_document
---```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```# reuseme
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[![CRAN status](https://www.r-pkg.org/badges/version/reuseme)](https://CRAN.R-project.org/package=reuseme)
[![R-CMD-check](https://github.com/olivroy/reuseme/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/olivroy/reuseme/actions/workflows/R-CMD-check.yaml)
[![Codecov test coverage](https://codecov.io/gh/olivroy/reuseme/graph/badge.svg)](https://app.codecov.io/gh/olivroy/reuseme)The goal of reuseme is to provide utility functions for project management across RStudio projects.
Sometimes, managing multiple projects can be challenging. reuseme also aims to simplify project management on Windows.
You may need to switch quickly to a project, add things or browse a certain file if you have some replications across projects.
Sometimes, it is hard to do that.
reuseme also aims to help me overcome things I don't like on Windows.## Installation {.unnumbered}
You can install reuseme like so:
``` r
# Cran
install.package("reuseme")
# R-universe (dev)
install.packages('reuseme', repos = c('https://olivroy.r-universe.dev', 'https://cloud.r-project.org'))# From GitHub (dev)
pak::pak("olivroy/reuseme")
```## Getting started
reuseme is adapted for a standard workflow, recommended in (find resources)
- Anyone working in RStudio (recent version for hyperlink support)
- Work with RStudio projects
- Your RStudio projects are organized in a centralized location on your computer
- Your RStudio projects are Version controlled with git (optional, but recommended for avoiding surprises! No need to be hosted on repositories like GitLab or GitHub)
- You use machine and human-readable paths (i.e. no spaces, special characters) (Tip: don't hesitate to rename your files (`reuseme::rename_files2()`), your future self will thank you!To take advantage of reuseme, it is highly recommended to set the following option in your `.Rprofile`
``` r
options(reuseme.reposdir = c("~/rrr", "any-other-directories-that-contain-rstudio-projects"))
```This will enable functions like `proj_switch()`, `proj_list()`, `use_todo()` to be optimized.
## Example
Since the package is meant for interactive use, there may not be a lot of code.
It takes advantage of [cli hyperlinks](https://cli.r-lib.org/reference/links.html) to improve productivity.```{r}
#| title: hello
library(reuseme)
## basic example code
```Most of these functions are meant to be used in RStudio, and in RStudio Projects, as they have not been widely tested outside this context.
In interactive sessions, you can use the `screenshot()` function to access an image in the clipboard and save it as .png in a `figures/` or `images/`directory in your RStudio project.
reuseme helps you work across projects, with the `proj_switch()` function.
`proj_switch()` works a lot like `usethis::proj_activate()` with the advantage of only typing the project name, instead of the full path.
By default, reuseme looks at `options(reuseme.reposdir)`, that is a vector of paths where repositories are located.
Personally, I use `~/rrr` (for my own projects) and `~/rrr-forks` (for projects I contribute to).When not supplying the `proj` argument, many functions will just offer you to choose, with a user interface built on [cli hyperlinks](https://cli.r-lib.org/reference/links.html).
### Extend usethis functionality
usethis is fantastic to manage workflow within a project, but is harder across projects.
If you want to work across projects with [usethis](usethis.r-lib.org), you need to provide the full path to a project.
With reuseme, just use the project name!+--------------------------------------------------------------------------------+----------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
| Workflow | reuseme | usethis |
+================================================================================+==================================================================================+======================================================================================================================================+
| Switch to project "cool-project" | `proj_switch(proj = "cool-project")` | `proj_activate(path = "C:/users/long/path/to/cool-project")` |
+--------------------------------------------------------------------------------+----------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
| Write a TODO item in project "cooler-project", while working in "cool-project" | `reuseme::use_todo(todo = "I need to do this ASAP as possible", proj = "cooler-project")` | `usethis::write_union(path = "C:/Users/I/do/not/want/to/type/cooler-project/TODO.R", lines = "I need to do this ASAP as possible.")` |
+--------------------------------------------------------------------------------+----------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
| Open pkgdown site link and see vignettes | 1. \`browse_pkg("usethis") | 1. `browse_package("usethis")` |
| | 2. Click on the hyperlinks that correspond to your query | 2. Type the correct number that corresponds |
| | | 3. `browseVignettes("usethis")` |
| | | 4. Open it |
+--------------------------------------------------------------------------------+----------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+: usethis vs reuseme
## Proposing a data analysis workflow
# Outline speed
```{r}
#| echo: false
#| output: false
# For example purpose, show all to spot potential files.
withr::local_envvar("TESTTHAT" = "true")
withr::local_options("reuseme.recent_indicator" = "")
```Due to the growing number of criteria, regex, `file_outline()` is slowing down a bit. I will address that.
```{r}
#| warning: false
#| message: false
bench::mark(
outline <- proj_outline()
)
```Example outline
```{r}
outline
```