r - Loading .RData file into Data Science Experience -


i trying load .rdata file r notebook in dsx. have followed instructions in notebook (https://apsportal.ibm.com/exchange/public/entry/view/90a34943032a7fde0ced0530d976ca82) still unable load data. far, have been successful in following steps:

  1. i have loaded dataset object storage.
  2. i inserted credentials using insert code -> insert credentials button. seemed work expected.
  3. in next cell, chose insert code -> insert textconnection object option. seemed work expected also.
  4. the output of step # 3 follows:

your data file loaded textconnection object , can process data package of choice.

data.1 <- getobjectstoragefilewithcredentials_xxxxxxxxxx("projectname", "file.rdata")

  1. after this, since file .rdata file, typed following command:

data <- load("file.rda")

when ran cell, got following output:

warning message in readchar(con, 5l, usebytes = true): “cannot open compressed file 'file.rda', probable reason 'no such file or directory'”

error in readchar(con, 5l, usebytes = true): cannot open connection traceback:

  1. load("file.rda")
  2. readchar(con, 5l, usebytes = true)

  3. when type in following command print dataset:

data

i following output:

x.html..h1.forbidden..h1..p.access.was.denied.to.this.resource...p...html.

please can help?

thanks, venky

here workaround given load can't read response object since read objects object storage, way rest api.

i tried use rawconnection instead of textconnection seems not helping.

so instead of passing read object os directly load or readrds function.you can write gpfs of spark service attached , read there same reading local.

change lines generated code:-

    rawdata <- content(httr::get(url = access_url, add_headers ("content-type" = "application/json", "x-auth-token" = x_subject_token)), as="raw") rawdata 

basically instead of returning text , return raw object , write binary object local gpfs.

data.3 <- getobjectstoragefilewithcredentials_216c032f3f574763ae975c6a83a0d523("testobjectstorage", "sample.rdata")   writebin(data.3,"sample.rdata") 

now read using readrds or load.

load("sample.rdata") 

to see loaded dataframe. ls()

i hope helps.

thanks, charles.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -