Henrik Bengtsson on Nostr: Wouldn't it be neat if we as #RStats package developers could declare that some of ...
Wouldn't it be neat if we as #RStats package developers could declare that some of the exported functions should not be attached by library()? Something like this:
> library(somepkg)
> hello()
hello world
> bye()
Error: object 'bye' not found
while you can still call:
> somepkg::bye()
bye bye
We can achieve this by adding a single line to base::library(), such that the package can declare bye() to be excluded when attached;
.packageExclude <- c("bye")
See
https://github.com/HenrikBengtsson/Wishlist-for-R/issues/165Published at
2024-06-26 21:17:55Event JSON
{
"id": "0cd5e218c2e5f21989dc9a02d5a1939c9038d745a75af0c9958ea861682ec1aa",
"pubkey": "042aae24355e3a9a908d3ea04fa667c0823466d0fd0fe5614d95718cb7724c58",
"created_at": 1719436675,
"kind": 1,
"tags": [
[
"t",
"rstats"
],
[
"proxy",
"https://mastodon.social/users/henrikbengtsson/statuses/112685001961033147",
"activitypub"
]
],
"content": "Wouldn't it be neat if we as #RStats package developers could declare that some of the exported functions should not be attached by library()? Something like this:\n\n\u003e library(somepkg)\n\u003e hello()\nhello world\n\u003e bye()\nError: object 'bye' not found\n\nwhile you can still call:\n\n\u003e somepkg::bye()\nbye bye\n\nWe can achieve this by adding a single line to base::library(), such that the package can declare bye() to be excluded when attached;\n\n.packageExclude \u003c- c(\"bye\")\n\nSee https://github.com/HenrikBengtsson/Wishlist-for-R/issues/165",
"sig": "aee54a91f17e9a3aeb8a096cea61ac44413e787642a7a7fb0752fe798edddf3d8e632eec01dffdc19c9f9bb4a57b1906eade4f3201c3c7f355ce0b8b20bf5ca2"
}