You need to switch to a shell with the same environment variable settings that Sage uses. sage -sh starts such a shell for you, and then package installation will work on sage's copy of R instead of the system copy. More details are described for a similar question here:
You need to could switch to a shell with the same environment variable settings that Sage uses. sage -sh starts such a shell for you, and then package installation will might work on sage's copy of R instead of the system copy. More details are described for a similar question here: