Community Conundrum 10: The Titanic is now live Learn more

Error in R-recipe to generate dataset

Level 1
Error in R-recipe to generate dataset

Hello,



I run 3 lines of code to produce a dataset in R and expose it to DSS. However, it gives an error I don't understand. Do you have any idea why this is happening?



Error log:




[14:41:40] [INFO] [dku.utils] - > library(dataiku)
[14:41:41] [INFO] [dku.utils] - > mydata <- data.frame(a=c(0,1,2),b=c(0,1,2),c=c(0,1,2))
[14:41:41] [INFO] [dku.utils] - > dkuWriteDatasetSchema(mydata,"test_r_dynamic_in")
[14:41:41] [INFO] [dku.utils] - Error in parsed$detailedMessage :
[14:41:41] [INFO] [dku.utils] - object of type 'externalptr' is not subsettable


Many thanks,



Cameron

0 Kudos
2 Replies
Level 2

Hi Cameron,



Using `dkuWriteDataset` will write the schema and the dataset:




library(dataiku)

r_test <- data.frame(name = c('jed','bob'), age = c(12, 5))

# Recipe outputs
dkuWriteDataset(r_test,"r_test")


 

Level 1
Author
Hi Jed,

Thanks for the reply. I get the same error (see below). Also, it is using deprecated code.
To reproduce, I:
Click on +RECIPE/Code/R.
Add an output named r_test.
Click on CREATE RECIPE.
Copy paste your code, then save.
Exit to flow diagram, click on the r_test glyph.
Click Build.

Log:

[16:09:16] [INFO] [dku.utils] - > library(dataiku)
[16:09:16] [INFO] [dku.utils] - >
[16:09:16] [INFO] [dku.utils] - > r_test <- data.frame(name = c('jed','bob'), age = c(12, 5))
[16:09:16] [INFO] [dku.utils] - >
[16:09:16] [INFO] [dku.utils] - > # Recipe outputs
[16:09:16] [INFO] [dku.utils] - > dkuWriteDataset(r_test,"r_test")
[16:09:16] [INFO] [dku.utils] - Error in parsed$detailedMessage :
[16:09:16] [INFO] [dku.utils] - object of type 'externalptr' is not subsettable
[16:09:16] [INFO] [dku.utils] - Calls: dkuWriteDataset -> write.dataset_schema
[16:09:16] [INFO] [dku.utils] - In addition: Warning message:
[16:09:16] [INFO] [dku.utils] - 'write.dataset_schema' is deprecated.
[16:09:16] [INFO] [dku.utils] - Use 'dkuWriteDatasetSchema' instead.
[16:09:16] [INFO] [dku.utils] - See help("Deprecated")
[16:09:16] [INFO] [dku.utils] - Execution halted
0 Kudos