Loading Packages from Rscript

Asked 1 years ago, Updated 1 years ago, 36 views

When I install a package from RGui on Windows and library, it reads, but when I try to load the same package from Rscript, it says it doesn't exist. How can I make Rscript recognize the additional package?

r rscript

2022-09-30 17:17

1 Answers

There was an explanation in the Rscript documentation.
https://stat.ethz.ch/R-manual/R-devel/library/utils/html/Rscript.html

Here are some excerpts.

Additional options accepted (before file or args) are

--default-packages=list
where list is a comma-separated list of packages names or NULL.Sets the environment variable R_DEFAULT_PACKAGES which determines the packages loaded on startup.The default for Rscript items methods as it takes about 60% of the startup time.

In summary,

  • Adding options before R files and arguments you want to load
  • Set the environment variable R_DEFAULT_PACKAGES to load at startup.
  • If you boot with Rscript, what is the default (compared to booting with Rgui)?Note) 60% of the methods are omitted.

    Rscript--default-packages=util hoge.r

When booting with Rscript, the default (compared to booting with Rgui)?Note) 60% of the methods are omitted.

Rscript--default-packages=util hoge.r

It should be done in a way like this.


2022-09-30 17:17

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.