dkuSourceLibR() in Rmarkdown report error

Options
AndriaM
AndriaM Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered Posts: 1

Hello,

Is there a way to import custom libraries in RMarkdown report?
In R code recipe or in notebooks I can use dkuSourceLibR("name_of_library.R") but it results in an error in RMarkdown.

library(dataiku) is correctly imported at the beginning of the report.

Thanks.

Best Answer

  • Catalina
    Catalina Dataiker, Dataiku DSS Core Designer, Registered Posts: 135 Dataiker
    Answer ✓
    Options

    Hi @AndriaM
    ,

    Importing custom libraries in R Markdown Report using dkuSourceLibR() is not working if your DSS instance has UIF enabled.

    A possible option is to add the R files to a managed folder, then use dkuManagedFolderPath() to read the file:

    managed_folder_path <- dkuManagedFolderPath("folder_ID")test <- paste0(managed_folder_path, "/", "test.R")

    In the case that the manage folder is not on the local file system, you could use dkuManagedFolderDownloadPath to read the file from the managed folder:

    # Read filerfile <- dkuManagedFolderDownloadPath(folder, "test.R", as = "raw")tmp <- tempfile("tmp",fileext=".R")tmp_file <- file(tmp, "wb")writeBin(rfile, tmp_file)close(tmp_file)

Setup Info
    Tags
      Help me…