Re: [R-pkg-devel] Question regarding finding the source file location without R-packages outside of R-Studio

2023-11-23 Thread Jan van der Laan
Can't/don't you use relative paths? library(..., lib.loc = "./MyLibrary") Then your project is perfectly portable. The only thing you need to take care of is to run your code from your project directory. In R-studio this is easily done by using projects. Outside of R-studio it depends on

Re: [R-pkg-devel] Question regarding finding the source file location without R-packages outside of R-Studio

2023-11-23 Thread Iris Simmons
I think 'package:renv' does a lot of the stuff you mentioned here. I think they accomplished your issue by making an .Rprofile file for each project. The working directory would be set to the root directory of the project, the R profile runs and sets .libPaths() as appropriate, then the scripts

Re: [R-pkg-devel] Question regarding finding the source file location without R-packages outside of R-Studio

2023-11-23 Thread Ivan Krylov
On Thu, 23 Nov 2023 19:39:48 + Tony Wilkes wrote: > This brings me to my actual question: is it possible to determine the > source file location of an R script This depends on how the script is being run. With source(file, keep.source = TRUE), you can define a function and immediately ask

Re: [R-pkg-devel] Question regarding finding the source file location without R-packages outside of R-Studio

2023-11-23 Thread Berry Boessenkool
According to the description, this should be what you need: https://cran.r-project.org/web/packages/scriptName/ I only got NULL, but I also only tried within Rstudio... Here are some related questions, although you've probably already tried the answers:

Re: [R-pkg-devel] Question regarding finding the source file location without R-packages outside of R-Studio

2023-11-23 Thread Ben Bolker
Not sure, but I think the 'here' package might do what you want. It's tidyverse-affiliated but pretty stable On Thu, Nov 23, 2023, 2:39 PM Tony Wilkes wrote: > Hi everyone, > > I have a question. I hope it's not a stupid question. > > Suppose you'd want to perform version control and project

[R-pkg-devel] Question regarding finding the source file location without R-packages outside of R-Studio

2023-11-23 Thread Tony Wilkes
Hi everyone, I have a question. I hope it's not a stupid question. Suppose you'd want to perform version control and project isolation. You'd create a project folder (let's call it "MyProject"), and place all the R packages you need for that project inside a subfolder (let's say