here
here copied to clipboard
Feature request: here() that keeps paths short with RProjects
Neat package to have pathnames work across Macs and Windows. Curious if there exists a plan to have here() get integrated with RProjects to keep pathnames short.
For instance RProjects would produce a pathname that would look like: data/a_raw_data/subdirectory/dataset.gpkg.
here::here() for a similar location would produce something like: users/USER/documents/project/data/a_raw_data/subdirectory/dataset.gpkg
Does this make sense? Being able to combine here with RProject would provide a powerful collaborative capability between colleagues using different operating systems.
Thanks. What is RProjects?
It is a nice feature of RStudio. Many benefits, but a significant one is the ability to have version control with Git and have streamlined pathnames for directories and data. RProjects are often self-contained.
Are you looking for fs::path_rel()
?
library(here)
#> here() starts at /Users/kirill/git/R/fledge
path <- here::here("R/auto.R")
path
#> [1] "/Users/kirill/git/R/fledge/R/auto.R"
fs::path_rel(path)
#> R/auto.R
Created on 2024-02-15 with reprex v2.1.0