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:
- i have loaded dataset object storage.
- i inserted credentials using insert code -> insert credentials button. seemed work expected.
- in next cell, chose insert code -> insert textconnection object option. seemed work expected also.
- 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")
- 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:
- load("file.rda")
readchar(con, 5l, usebytes = true)
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
Post a Comment