Importing RData Files in DataIku

Solved!
OrsonWelles
Level 2
Importing RData Files in DataIku

Hi,

Is it possible to import from an RData file (usually with extension . rdata or . rda) a DataIku dataset ?.

If not what is the proper way to deal with .rda files and integrate them in a flow ?

Thanks in advance. Best Jean-Daniel 

0 Kudos
1 Solution
AlexandreL
Dataiker

Hi, 

RData is not a table and needs to be loaded prior to extracting the table you need to write in your dataset, so there is no builtin way to do it.

However,  you can create a managed folder on your flow in which you can store your RData file. From this folder, create an R recipe that takes your folder as input, and a dataset as output. The code in your R recipe should look like this:

# Load R Data
r_folder <- dkuManagedFolderPath("folder_id")
path <- paste(r_folder, 'filename.rda', sep="/")
load(path)

# Get the dataframe of interest
df = dataframe_of_interest

dkuWriteDataset(df,"dataset_name")

 

Where folder_id is your input folder's id, dataframe_of_interest is the name of your dataset when it was saved in your .rda file, and dataset_name is the name of your recipe's output dataset.

View solution in original post

2 Replies
AlexandreL
Dataiker

Hi, 

RData is not a table and needs to be loaded prior to extracting the table you need to write in your dataset, so there is no builtin way to do it.

However,  you can create a managed folder on your flow in which you can store your RData file. From this folder, create an R recipe that takes your folder as input, and a dataset as output. The code in your R recipe should look like this:

# Load R Data
r_folder <- dkuManagedFolderPath("folder_id")
path <- paste(r_folder, 'filename.rda', sep="/")
load(path)

# Get the dataframe of interest
df = dataframe_of_interest

dkuWriteDataset(df,"dataset_name")

 

Where folder_id is your input folder's id, dataframe_of_interest is the name of your dataset when it was saved in your .rda file, and dataset_name is the name of your recipe's output dataset.

OrsonWelles
Level 2
Author

Dear AlexanderL,

It works like a charm. Great Explanation. Managed Folder is a Nice feature I had not thought of.

Thanks, Best Jean-Daniel