Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
959 views
in Technique[技术] by (71.8m points)

install R package requiring dll

I am looking at this package. I managed to install it like this:

library(devtools)
install_github("profyliu/gepR")

This package also requires a dll, which I downloaded. I think I can put this dll into my working directory but could it also be placed into the folder of the package and the R file would pick it up automatically (the R file linked to in github is also in my local package folder)?

Thanks and sorry about my ignorance.

question from:https://stackoverflow.com/questions/65869506/install-r-package-requiring-dll

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I think you can. Look at function gep_load_dll from gepR.R

#' Load gepR.dll
#' @param dll_file the path and name of the dll file to be loaded.
gep_load_dll <- function(dll_file = "gepR.dll"){
  dyn.load(dll_file)
}

I think you just have to change the variable for this function such that it is the path to the dll file. To me it seems that the package does not care where you put it.

So just put the file into the directory you want, call this function with the path to the file and you should be fine. Particularely, when we also consider the example from the demo, where we find this code

gep_load_dll()  # Load the gepR.dll from the default location
gepmod <- gep_train(y = train_y, x = train_x, maxiter = 1000, goal=0.95, nthreads = 10)

The comment seems to suggest that you can put it anywhere you like as long as you overwrite the default location.

Please note that I have not tried it out myself because I'm not a windows user. If it works, please let us know.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...