Unexpected behavior of R after install on another EC2 instance

ぐ巨炮叔叔 提交于 2019-12-24 22:28:40

问题


I'm fighting this problem second day straight with a completely sleepless night and I'm really starting to lose my patience and strength. It all started after I decided to provision another (paid) AWS EC2 instance in order to test my R code for dissertation data analysis. Previously I was using a single free tier t1.micro instance, which is painfully slow, especially when testing/running particular code. Time is much more valuable than reasonable number of cents per hour that Amazon is charging.

Therefore, I provisioned a m3.large instance, which I hope should have enough power to crunch my data comfortably fast. After EC2-specific setup, which included selecting Ubuntu 14.04 LTS as an operating system and some security setup, I installed R and RStudio Server per instructions via sudo apt-get install r-base r-base-dev as ubuntu user. I also created ruser as a special user for running R sessions. Basically, the same procedure as on the smaller instance.

Current situation is that any command that I issuing in R session command line result in messages like this: Error: could not find function "sessionInfo". The only function that works is q(). I suspect here a permissions problem, however, I'm not sure how to approach investigating permission-related problems in R environment. I'm also curious what could be the reasons for such situation, considering that I was following recommendations from R Project and RStudio sources.


回答1:


I was able to pinpoint the place that I think caused all that horror - it was just a small configuration file "/etc/R/Rprofile.site", which I have previously updated with directives borrowed from R experts' posts here on StackOverflow. After removing questionable contents, I was able to run R commands successfully. Out of curiosity and for sharing this hard-earned knowledge, here's the removed contents:

local({
  # add DISS_FLOSS_PKGS to the default packages, set a CRAN mirror
  DISS_FLOSS_PKGS <- c("RCurl", "digest", "jsonlite",
                       "stringr", "XML", "plyr")
  #old <- getOption("defaultPackages")
  r <- getOption("repos")
  r["CRAN"] <- "http://cran.us.r-project.org"
  #options(defaultPackages = c(old, DISS_FLOSS_PKGS), repos = r)
  options(defaultPackages = DISS_FLOSS_PKGS, repos = r)

  #lapply(list(DISS_FLOSS_PKGS), function() library)
  library(RCurl)
  library(digest)
  library(jsonlite)
  library(stringr)
  library(XML)
  library(plyr)
})

Any comments on this will be appreciated!



来源:https://stackoverflow.com/questions/23357551/unexpected-behavior-of-r-after-install-on-another-ec2-instance

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!