Closed rogerssam closed 3 years ago
I am also torn about editing / writing / altering ~/.Rprofile
. Too much can go wrong for too little gain in my opinion.
That leaves us with two choices. Documenting the (after all somewhat trivial) one-line change in the FAQ, and/or mentioning other solutions for startup. For example for the last few years I have been using this (following some on-line discussions years ago with I no-longer-remember-whom, but I have shown this before)
if (dir.exists("~/.R/profile.d")) {
files <- list.files("~/.R/profile.d", pattern=".*\\.R$", full.names=TRUE)
for (f in files) {
source(f)
}
}
and now ~/.Rprofile
remains unchanged and I just drop new files into ~/.Rprofile.d
. Perfect also for e.g. having ~/.Rprofile
in a repo and possibly public but keeping s3cr3t keys hidden in that that directory :)
There are now similar programmatic approach. @henrikbengtsson wrote startup which generalises the idea above. But adding another dependency just for the one-liner is not exactly the right approach for drat
either.
All that said, the longer I think about this the more I think to not change drat
at all. This really really is just a matter of local config just how you would add a BioConductor repo, say, or a company repo. Just do it.
This can be closed, the lack of following suggests the issue is addressed. If more is needed please reopen and ideally demonstrate with small reproducible examples why.
Hi Dirk,
Firstly thank you so much for your work on this package - I've started using it recently and it's fantastic!
I've been wondering what the best way is to assist novice users to persist a drat repo across R sessions though? I.e. at present the drat repo only survives in the session
drat::addRepo()
is run in, so restarting R essentially leaves orphaned packages again. My main motivation is to enable easy updates to "non-cran" packages.It's a (relatively simple) matter of adding it to a user's .Rprofile file, but knowing what to add and where can be daunting for inexperienced users.
In the first instance, some more explicit instructions in the documentation/FAQ might be useful. I've also been wondering about writing a small helper function that would assist with this, so people don't have to know or care about it - it just does it for them. Perhaps even via an argument in the
addRepo
function similar toaction
ininsertRepo()
, though I'm torn if writing to people's .Rprofile files is a good idea?What are your thoughts around this? Am I misunderstand intended behaviour? Would one or both be useful do you think? I am happy to provide a PR for either or both if you think it's a worthwhile enhancement.