How to install my own R packages using SSH

I want to run R codes on HPC, and the premise is that I need to install a local package, which is written by another author (for windows and mac versions). So I could not use the command 'install.packages()'.
I tried dragging the local package into my environment in SSH Secure File Transfer, but when I library the package, I got errors as below.

(for windows version packages)Error: package or namespace load failed for 鈉zfactor?in library.dynam(lib, package, package.lib): shared object 鈉zfactor.so?not found

or:

(for mac version packages)Error: package or namespace load failed for 鈉zfactor?in dyn.load(file, DLLpath = DLLpath, ...): unable to load shared object '/data/home/y/R/x86_64-pc-linux-gnu-library/libs/鈉zfactor/libs/鈉zfactor.so': /data/home/y/R/x86_64-pc-linux-gnu-library/libs/鈉zfactor/libs/czfactor.so: invalid ELF header
In addition: Warning message:
package 鈉zfactor?was built under R version 4.1.1

So how could I library that local package using SSH? Which version should I choose?
Thank you very much.

You can't use binaries compiled for Windows and Mac on a Linux machine, if you hace access to the source code, you can try to compile the package for Linux although it might not be possible depending on the specific package (some packages rely on OS specific libraries). Without knowing more about the package and how it has been handed to you, it is hard to give you any specific advice.

1 Like

I guess it is this package here ==> cbw.htm ?

Thank you very much for your reply. That is indeed the R package I need to install.

But as andresrcs said, I can't install them in linux system. I'm not good at programming and don't know how to compile the package for Linux :sob:. I would be very grateful if you could help me. Thank you very much!

@andresrcs is correct - you can't easily install an R package that only exists as Mac or Windows binary into the linux system. So your only chance would be to see if you can get the source code from the authors or ask them to build a linux binary for you.

Other options still exist, but they are infinitely more complex than to get the source code or a linux binary from the authors.

1 Like

I see, thank you both very much for your kind help. Have a nice day!