I am a bit confused about this. I have an R package that has a small function (not a mayor part of the package) in which the principal
function of the psych
package is called. How do I correctly specify this in DESCRIPTION and NAMESPACE?
Setting Depends: psych
in DESCRIPTION makes sure the psych package is loaded every time my package is loaded. This works, but it seems redundant for such a small part of my package.
Setting Suggests: psych
and entering a require("psych")
in the function is what I do now, however this does not work if psych
is not installed, and seems to be the wrong way of doing this (writing R extensions says that suggest is meant mainly for examples).
I think I need to import the function. I tried setting Imports: psych
in DESCRIPTION and importFrom(psych,"principal")
in NAMESPACE. This works, but on a computer that does not has psych installed it gives an error when loading my package.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…