If I download an "package-name".tar.gz file from CRAN website, gunzip and untar it into a custom directory, how do I load that package from within R? I cannot extract the file in the R installation directory.
相关问题
- How does the setup bootstrapper detect if prerequi
- R - Quantstart: Testing Strategy on Multiple Equit
- Using predict with svyglm
- Reshape matrix by rows
- Extract P-Values from Dunnett Test into a Table by
相关文章
- How to convert summary output to a data frame?
- How to plot smoother curves in R
- Paste all possible diagonals of an n*n matrix or d
- Getting errors / failing tests when installing Pyt
- ess-rdired: I get this error “no ESS process is as
- How to use doMC under Windows or alternative paral
- dyLimit for limited time in Dygraphs
- How do you make an installer for your python progr
You need to install the package to a directory to which you have permission to read and write. First, download the package to an easily accessible directory. If you're on Linux/Mac, try creating a directory called 'rlib' in your home directory.
If you would prefer to install the package from R, do this:
Try using Hadley Wickham's
devtools
package, which allows loading packages from a given directory:you dont need to unzip or untar
just give this command in command prompt and it will unzip into appropriate place
R CMD INSTALL [options] [l-lib] pkgs.tar.gz
as explained here
then you can use it in R by
library(the_pkg)
You can't call
R CMD INSTALL downloadedpackage.gz
?As I understand it, this should install the package in your user-space if it cannot get write permissions to the R installation folder
Please add some extra information on the operating system. If you're on windows, you need Rtools ( http://www.murdoch-sutherland.com/Rtools/ ) to build from source. See that website for more information on how to install everything you need.
Even when you're on Linux, simply extracting the package-file doesn't work. There might be underlying C-code (which is the case for the
MSBVAR
package), and even R code has to be processed in order to be built into a package that can be loaded directly with thelibrary()
function.Plus, you have to take into account that the package you want to install might have dependencies. For the
MSBVAR
package, these are the packagescoda
andbit
. When building from source, you need to make sure all dependencies are installed as well, or you can get errors.apart from the R CMD INSTALL you could try from within R :
or why not just do
This works perfectly fine.