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

Preload default packages by default #17

Open
genmeblog opened this issue Feb 4, 2020 · 8 comments
Open

Preload default packages by default #17

genmeblog opened this issue Feb 4, 2020 · 8 comments
Labels
enhancement New feature or request

Comments

@genmeblog
Copy link
Member

Preload default packages by default, ie: stats, base, graphics, datasets, grDevices, probably more.

@daslu daslu added the enhancement New feature or request label Feb 7, 2020
@awb99
Copy link

awb99 commented Jun 1, 2020

Perhaps you want to do add a configuration map, that fully defines the R environment that you want to have? You even could check, if required packages are installed, and if not, install them. Or you might want to have two functions (load-env config) and (install-load-env config). So in a way instead of needing a R install plus installed packages, you would need only an installed R. You would do something similar to lein project.clj. And you could even make a lein plugin, that would read :clojisr key from project.clj. lein-ring does this for example.

@genmeblog
Copy link
Member Author

The problem here is that you don't know which backend is used. Renjin library installing is different. Also sometimes you want to install using dev_tools or install from other servers than cran. I would leave such configuration on the R side. Anyway load-env config is great idea and could be great.

The original idea is to load all packages which are preloaded by default by R. But it takes time and is not lazy. So I'm not sure if we should do this or not.

@awb99
Copy link

awb99 commented Jun 1, 2020

I think what you should do is define a default-config map. And then the user can define his own
config map; and on start you would merge the user config with the default config. this way you allow extensibility of packages, and perhaps some other stuff too.

You also might pass custom init namespace to clojisr, similar to how leiningen can initialize a nrepl connection with some namespace and run an init function.

Perhaps also you want to run r init in a future. And the future sets an atom indicating init-complete; and then all R evals would only run after init-complete.

The future approach makes sense when developing models in the repl. Then you can do certain stuff while R us still initializing, and dont have to wait foreer for the app to bootstrap.

Just an idea...

@genmeblog
Copy link
Member Author

Good idea. Let's wait for session management to push this forward.

@behrica
Copy link
Member

behrica commented May 6, 2024

I would preload these, as R does:

> search()
[1] ".GlobalEnv"        "package:stats"     "package:graphics" 
[4] "package:grDevices" "package:utils"     "package:datasets" 
[7] "package:methods"   "Autoloads"         "package:base" 

@genmeblog
Copy link
Member Author

Good point. The question is how they should be loaded. As :refer :all in clojisr.v1.r namespace or maybe as aliases?

@genmeblog
Copy link
Member Author

If #94 is done, we can't load above upfront...

@behrica
Copy link
Member

behrica commented May 7, 2024

So maybe a function like load-default-packages makes sense.

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

No branches or pull requests

4 participants