From edd at debian.org  Tue Dec 26 15:40:46 2017
From: edd at debian.org (Dirk Eddelbuettel)
Date: Tue, 26 Dec 2017 08:40:46 -0600
Subject: [Rd] Rscript fails with some packages (for example, h5)
In-Reply-To: <CAL109eMSq6=mbSzrMnktNiOw=z5C=Tj7nDg9o4zNir-h5pCywg@mail.gmail.com>
References: <CAL109eMo37PYMgE8KV0rxBgCGe-6Z1NhPrsUiQJfqCoJXfk6CA@mail.gmail.com>
 <23106.17557.985432.335423@bud.eddelbuettel.com>
 <CAL109eMSq6=mbSzrMnktNiOw=z5C=Tj7nDg9o4zNir-h5pCywg@mail.gmail.com>
Message-ID: <23106.24430.6935.8034@bud.eddelbuettel.com>


On 26 December 2017 at 22:14, Sun Yijiang wrote:
| Thanks for the solution.  Now I know the work-arounds, but still don't
| quite get it. Why does R_DEFAULT_PACKAGES has anything to do with
| library(methods)?

Because it governs which packages are loaded by default.  And while R also
loads 'methods', Rscript does not. Source of endless confusion.

| If library(h5) works, it should just work, not depend on an environment variable.

Every package using S4 will fail under Rscript unless 'methods' explicitly.

| Rscript is not consistent with R, that's my confusion.

Indeed. And you are not the first person confused by it.

Dirk

-- 
http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org



[Rd] Rscript fails with some packages (for example, h5)
Dirk Eddelbuettel