Code Monkey home page Code Monkey logo

Comments (4)

leowill01 avatar leowill01 commented on May 18, 2024 3

Can we please have this implemented? I'd like to use {here}, but currently the here() function is nearly useless to me because I have a lot of nested folders and I don't memorize the long paths in order to specify where a file or folder is by manually typing in each item in the path from the here() root.

from here.

abalter avatar abalter commented on May 18, 2024

I was about to make this request myself. I huge downside of file.path and here is the lack of tab completion.

from here.

krlmlr avatar krlmlr commented on May 18, 2024

Thanks for the nudge.

In RStudio, you could type

here("file<tab>

and it would autocomplete the file with its full path relative to the RStudio project (which is frequently also the project root):

here("my/local/file.txt"

This is a perfectly valid input for here() . Would that help? Do we need to document this better?

from here.

abalter avatar abalter commented on May 18, 2024

I am considering a use case that goes beyond that, and may not be something that is a goal for {here}. Highly structured projects can lead to tall directory trees:

(base) balter@expiyes:~$ tree rnaseq_proj/
rnaseq_proj/
├── align
│   ├── logs
│   ├── reports
│   ├── results
│   └── src
│       ├── alignment_diagnostics.Rmd
│       └── run_bwa.Rmd
├── config.R
├── data
│   └── raw
│       └── test.fastq
├── setup
│   ├── logs
│   ├── reports
│   ├── results
│   └── src
│       └── run_fastqc.Rmd
└── trim
    ├── logs
    ├── reports
    ├── results
    └── src
        ├── trim_diagnostics.Rmd
        └── trim_sequences.Rmd

So, I frequently like to create variables for file paths, e.g.:

raw_data_dir = here("data/raw")

Or, maybe I have another reason to have a folder name in a variable.

test_type = "raw"
test_fastq_file = here("data", test_type, "test.fastq")

I think it would be awesome if here and (file.path) would use intellisense so that I could do

data_dir = here("data")
test_fastq_file = here(data_dir, test_type, <tab>......

from here.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.