[R] load() failed to load .Rdata file in AWS-Ububtu

Eric Berger ericjberger at gmail.com
Mon Oct 9 09:07:25 CEST 2017


Hi Christofer,
The shiny code you have written does not depend on loading the Dat.RData
file.
I commented out that line and ran your shiny app on my machine and it works
fine.
What happens if you comment out  (or remove) the line
     load("/home/ubuntu/Dat.RData)
Does your shiny app still fail? If so, then your problem is quite basic
with your  AWS setup.
Try to work through a simple tutorial/documentation example that shows how
to get shiny running on AWS and see if following the steps helps you
discover the problem.

Good luck,
Eric




On Sun, Oct 8, 2017 at 8:05 PM, Christofer Bogaso <
bogaso.christofer at gmail.com> wrote:

> Thanks Eric for your pointer. However I just altered the argument of
> load() function a little bit to get that loaded. Below is the line
> what I tried.
>
> ubuntu at ip-172-31-23-148:~$ R
>
>
> R version 3.4.2 (2017-09-28) -- "Short Summer"
>
> Copyright (C) 2017 The R Foundation for Statistical Computing
>
> Platform: x86_64-pc-linux-gnu (64-bit)
>
>
> R is free software and comes with ABSOLUTELY NO WARRANTY.
>
> You are welcome to redistribute it under certain conditions.
>
> Type 'license()' or 'licence()' for distribution details.
>
>
>   Natural language support but running in an English locale
>
>
> R is a collaborative project with many contributors.
>
> Type 'contributors()' for more information and
>
> 'citation()' on how to cite R or R packages in publications.
>
>
> Type 'demo()' for some demos, 'help()' for on-line help, or
>
> 'help.start()' for an HTML browser interface to help.
>
> Type 'q()' to quit R.
>
>
> During startup - Warning message:
>
> Setting LC_CTYPE failed, using "C"
>
> > load("/home/ubuntu/Dat.RData")
>
> >
>
> However it still failing when I try that within my shiny app in AWS.
>
> Below are my ui.R and server.R files respectively.
>
> library(shiny)
>
> # Define UI for miles per gallon application
> fluidPage(
>       fluidRow(
>         column(12,
>           tableOutput('table')
>         )
>       )
>     )
>
> server.R :
>
> library(shiny)
>
> load("/home/ubuntu/Dat.RData")
>
> shinyServer(function(input, output) {
> output$table = renderTable(head(data.frame(1:20, 1:20), 20))
> })
>
> with above setup when I deploy my shiny app I get below error :
>
> 18.221.184.94:3838 says
> The application unexpectedly exited
> Diagnostic information has been dumped to the JavaScript error console.
>
> appreciate any help to get rid of this error.
>
> Thanks for your time.
>
> On Sun, Oct 8, 2017 at 12:39 AM, Eric Berger <ericjberger at gmail.com>
> wrote:
> > Hi Christofer,
> > The directory /srv/shiny-server would normally be owned by the root user.
> > Your options would seem to be to either (1) bring up the R session as
> root
> > (dangerous)
> > or (2) try copying the file to your local directory and read it from
> there
> > (if allowed).
> > e.g. from the Unix shell:
> >> cd ~   (i.e. cd to your home directory)
> >> cp /srv/shiny-server/Dat.Rdata .   (Note the '.' at the end. This may
> not
> >> work - if not then you can try the following
> >> sudo cp /srv/shiny-server/Dat.Rdata . (if you have sudo privileges -
> only
> >> do this if the former command did not work)
> >> chmod 777 Dat.Rdata  (a bit of overkill - again preface by sudo if it
> does
> >> not work without it)
> >
> > Then in your R session you can do the load from the file in this
> location.
> > R>  load("~/Dat.Rdata")
> >
> > HTH,
> > Eric
> >
> >
> > On Sat, Oct 7, 2017 at 8:54 PM, Christofer Bogaso
> > <bogaso.christofer at gmail.com> wrote:
> >>
> >> Hi again,
> >>
> >> I hope this is the right place to post my question on running R within
> >> Ubuntu, however if not, any pointer on right distribution list will be
> >> helpful.
> >>
> >> I am currently using R in Ubuntu which is hosted in Amazon - AWS.
> >>
> >> I have a .Rdata file in AWS which I am trying to load in R. Used
> >> following code, however, fails to load showing some permission issue.
> >> However that same .Rdata file is getting loaded perfectly when I try
> >> in my regular iOS.
> >>
> >> Below is my code and corresponding result :
> >>
> >> ubuntu at ip-172-31-23-148:~$ R
> >>
> >>
> >> R version 3.4.2 (2017-09-28) -- "Short Summer"
> >>
> >> Copyright (C) 2017 The R Foundation for Statistical Computing
> >>
> >> Platform: x86_64-pc-linux-gnu (64-bit)
> >>
> >>
> >> R is free software and comes with ABSOLUTELY NO WARRANTY.
> >>
> >> You are welcome to redistribute it under certain conditions.
> >>
> >> Type 'license()' or 'licence()' for distribution details.
> >>
> >>
> >>   Natural language support but running in an English locale
> >>
> >>
> >> R is a collaborative project with many contributors.
> >>
> >> Type 'contributors()' for more information and
> >>
> >> 'citation()' on how to cite R or R packages in publications.
> >>
> >>
> >> Type 'demo()' for some demos, 'help()' for on-line help, or
> >>
> >> 'help.start()' for an HTML browser interface to help.
> >>
> >> Type 'q()' to quit R.
> >>
> >>
> >> During startup - Warning message:
> >>
> >> Setting LC_CTYPE failed, using "C"
> >>
> >> > file.exists('/srv/shiny-server/Dat.Rdata')
> >>
> >> [1] TRUE
> >>
> >> > load('/srv/shiny-server/Dat.Rdata')
> >>
> >> Error in readChar(con, 5L, useBytes = TRUE) : cannot open the connection
> >>
> >> In addition: Warning message:
> >>
> >> In readChar(con, 5L, useBytes = TRUE) :
> >>
> >>   cannot open compressed file '/srv/shiny-server/Dat.Rdata', probable
> >> reason 'Permission denied'
> >>
> >> > readRDS('/srv/shiny-server/Dat.Rdata')
> >>
> >> Error in gzfile(file, "rb") : cannot open the connection
> >>
> >> In addition: Warning message:
> >>
> >> In gzfile(file, "rb") :
> >>
> >>   cannot open compressed file '/srv/shiny-server/Dat.Rdata', probable
> >> reason 'Permission denied'
> >>
> >>
> >> Can someone help me to understand where it went wrong with Ubuntu? I
> >> also tried with changing the extension from .Rdata to .RData, however
> >> observing the same error.
> >>
> >> Any pointer will be highly appreciated.
> >>
> >> Thanks for your time.
> >>
> >> ______________________________________________
> >> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> >> https://stat.ethz.ch/mailman/listinfo/r-help
> >> PLEASE do read the posting guide
> >> http://www.R-project.org/posting-guide.html
> >> and provide commented, minimal, self-contained, reproducible code.
> >
> >
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list