Skip to content
/ here Public

A simpler way to find your files

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md
Notifications You must be signed in to change notification settings

r-lib/here

Folders and files

NameName
Last commit message
Last commit date

Latest commit

b2c8df1 · Mar 16, 2025
Jan 26, 2024
Dec 8, 2024
Feb 6, 2023
Nov 15, 2020
Feb 6, 2023
Oct 10, 2023
Jan 26, 2024
Jan 26, 2024
Nov 15, 2020
Dec 9, 2024
Oct 30, 2020
Oct 30, 2020
Nov 13, 2020
Dec 9, 2024
Dec 31, 2023
Oct 29, 2021
Nov 15, 2020
Mar 16, 2025
Nov 11, 2020
Dec 13, 2020
Jul 19, 2016

Repository files navigation

here

Lifecycle: stable rcc CRAN status Codecov test coverage

The goal of the here package is to enable easy file referencing in project-oriented workflows. In contrast to using setwd(), which is fragile and dependent on the way you organize your files, here uses the top-level directory of a project to easily build paths to files.

Installation

Install the released version of here from CRAN:

install.packages("here")

Usage

The here package creates paths relative to the top-level directory. The package displays the top-level of the current project on load or any time you call here():

here::i_am("README.Rmd")
#> here() starts at /home/kirill/git/R/here
here()
#> [1] "/home/kirill/git/R/here"

You can build a path relative to the top-level directory in order to read or write a file:

here("inst", "demo-project", "data", "penguins.csv")
#> [1] "/home/kirill/git/R/here/inst/demo-project/data/penguins.csv"
readr::write_csv(palmerpenguins::penguins, here("inst", "demo-project", "data", "penguins.csv"))

These relative paths work regardless of where the associated source file lives inside your project, like analysis projects with data and reports in different subdirectories. See the included demo project for an example.

Illustration by Allison Horst


Code of Conduct

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