Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is RStudio required for here::i_am()? #73

Open
seed-of-apricot opened this issue Jul 19, 2021 · 6 comments
Open

Is RStudio required for here::i_am()? #73

seed-of-apricot opened this issue Jul 19, 2021 · 6 comments

Comments

@seed-of-apricot
Copy link

The below is what I get when I run the command. here::here() seems to work without the .Rproj file though.

> here::i_am("README.Rmd")
Error: Could not find associated project in working directory or any parent directory.
- Path in project: README.Rmd
- Current working directory: [path]
Please open the project associated with this file and try again.

> here::dr_here(show_reason = TRUE)
here() starts at [path].
- This directory contains a directory ".git"
- Initial working directory: [path]
- Current working directory: [path]
@arnyeinstein
Copy link

I had the same issue. Without the project file within R-Studio, here gives a message like above. This seems to be due to the "default directory" that is (automatically) set in the preferences.
If I open the file in visual code or emacs, the problem does not happen.

@KWigg4
Copy link

KWigg4 commented Jul 16, 2022

Any resolution to this? I'm dying with this issue and have been at it all day - I can't find anything in the rproj.user files or anything

@Anaphory
Copy link

When I ran into this issue just now, it took me a while to realize it was a typical stupid error: I had written
here::i_am("code/model-altas.r")
where the file was actually called model-atlas.r. So if you run into this error and cannot figure out the reason, check the spelling of your file name 🙈

@KleinWurm
Copy link

KleinWurm commented May 13, 2024

Same issue with here 1.0.1, RStudio 2024.04.0+735 and R version 4.3.2.
I tried to put a .here file in the same folder as the script I am running i_am() from without success.

Structure of the folder:

 test
    .here
     test_script.R

And the content of test_script.R is:

here::i_am(path = "test_script.R")

Console output when test_script.R is executed from RStudio:

> here::i_am(path = "test_script.R")
Erreur : Could not find associated project in working directory or any parent directory.
- Path in project: test_script.R
- Current working directory: C:/Users/Username/Documents
Please open the project associated with this file and try again.

It shows a similar error if I try

here::i_am(path = ".here")

However, if I run the script from Visual Studio, I get the expected output:

> here::i_am(path = ".here") # also works with "test_script.R" instead of ".here"
here() starts at C:/Users/[path]/test

This suggest an incompatibility of here::i_am() and RStudio.

@krlmlr
Copy link
Member

krlmlr commented May 20, 2024

Thanks, @KleinWurm. Finally picking up this thread.

When you try in RStudio, what does getwd() show?

@KleinWurm
Copy link

@krlmlr sorry for my late reply, I tried again with RStudio RStudio 2024.04.1+748 " and R version 4.3.2 and it seems that the here::i_am() function now works in RStudio with the same behavior as in Visual Studio.

From RStudio, I get the same output as from Visual Studio:

> here::i_am(path = "test_script.R") 
here() starts at C:/Users/[path]/test

And getwd() returns C:/Users/[path]/test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants