Skip to content

Option to return relative paths #36

@alanocallaghan

Description

@alanocallaghan

This package is really great. I have a particular usecase that I would be happy to implement a PR for if you think it fits the package.

I would like here() to be able to return paths relative to the cwd where possible.

My use case is that I have rmds files in src/ eg here(src/rmarkdown.Rmd) that are rendered to eg here(outputs/rmarkdown.md) with files in saved in here(outputs/myfiles), eg outputs/myfiles/figure-1.png.

Ideally I would like to set this in knitr, eg knitr::opts_chunk$set(fig.path = here("outputs/rmd_files/exploratory/")). However this means all figure paths are absolute directories, and this totally breaks the md files when moved outside of my PC. If here could return a relative path, I could ensure that the figure path is where I intend it to be while not breaking the links on upload to github etc.

Again, if you think this is a good idea, I'll submit a PR. If not, I'll engineer my own solution.

Cheers, hope I explained this okay.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions