R libraries and paths - overview

2019-09-11 07:40发布

I am using R Studio with R version 3.1. I am a bit confused about how the overall file paths and conventions work. If someone has a link to a good explanation that would be great.

I want to know if a package needs to be installed into the working directory ie do i need to set lib = "/xx/yy/zz" to the same place as the getwd() returns ?

I have supposedly succesfully installed RWeka --- package ‘RWeka’ successfully unpacked and MD5 sums checked however when I try "library("RWeka") i get the

"Error in library("Rweka") : there is no package called ‘Rweka’   "

After I had installed the package it said

"package ‘RWeka’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
    Installing package into ‘C:/Users/MY NAME/Documents/R/win-library/3.1’
(as ‘lib’ is unspecified)

hence the question - are all packages downloaded to the place where R is installed and thats ok as long as all the code and files we are trying to access are in the set working director.

Many thanks

Here is the train RWeka installed successfully however library(RWeka) shows the following

install.packages("RWeka") Installing package into ‘C:/Users/My Name/Documents/R/win-library/3.1’ (as ‘lib’ is unspecified) trying URL 'http://cran.rstudio.com/bin/windows/contrib/3.1/RWeka_0.4-23.zip' Content type 'application/zip' length 535623 bytes (523 Kb) opened URL downloaded 523 Kb

package ‘RWeka’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in C:\Users\My Name\AppData\Local\Temp\RtmpOc8SpX\downloaded_packages

library(RWeka) Error : .onLoad failed in loadNamespace() for 'rJava', details: call: fun(libname, pkgname) error: No CurrentVersion entry in Software/JavaSoft registry! Try re-installing Java and make sure R and Java have matching architectures. Error: package or namespace load failed for ‘RWeka’

So I guess the questions are 1. Something else to do other than installing Java from Java.com (have uninstalled and reinstalled no change) 2. I am using R 3.1.1

标签: r file
2条回答
霸刀☆藐视天下
2楼-- · 2019-09-11 07:55

Andy / Prakash are correct - the function in R

Sys.getenv("R_ARCH") will tell you whether you are running the 32 bit or 64 bit version of R

64 bit java can be downloaded here.

https://www.java.com/en/download/faq/java_win64bit.xml#Java%20for%2064-bit

查看更多
倾城 Initia
3楼-- · 2019-09-11 07:58

Please check if you are running R or R Studio on 32 or 64 bit version. Java and R must both be running the same version of architecture.

查看更多
登录 后发表回答