Sign up to take part
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
Hi
I want to save a data object from an R notebook in a managed folder on DSS so it can be read by a Jupyter notebook.
I am using
# data must be a connection providing the data to upload
data = c(0,1.1,2.2,3.3) dkuManagedFolderUploadPath("folder_name", "path_in_folder", data)
To upload the data but I am getting the following error:
Error in readBin(arr, double(), 6, size = 4): can only read from a binary connection Traceback: 1. readBin(arr, double(), 6, size = 4)
How can I solve this readBin error?
Operating system used: Windows
Hi @nadine ,
dkuManagedFolderUploadPath expects a connection object, not a vector. You'll need to save your data object to a temporary file first:
# Save `data` to a managed folder
library(dataiku)
data = c(0,1.1,2.2,3.3)
temp_filename <- tempfile("r-managed-folder-")
save(data, file=temp_filename)
temp_connection <- file(temp_filename, "rb")
dkuManagedFolderUploadPath("folder_name", "path_in_folder", temp_connection)
You can then load the data object using the following code:
# Load `data` from a managed folder
library(dataiku)
raw_data <- dkuManagedFolderDownloadPath("folder_name", "path_in_folder", as="raw")
temp_filename <- tempfile(pattern="r-managed-folder-")
writeBin(raw_data, temp_filename)
load(temp_filename)
cat(data, sep="\n")
Thanks,
Zach