Error in R Snippets but not R Views

Hi,

what is the difference between those nodes?
I started using only R Views and faking a plot with e.g. plot(1,2) since the normal R nodes fail for almost all my scripts.

And they are as simple as the following:

options(encoding = 'UTF-8')

require(PTXQC)
  
mztab_file = substr(knime.flow.in[["URI-0"]],6, nchar(knime.flow.in[["URI-0"]]))

fn = PTXQC:::getReportFilenames(dirname(mztab_file), TRUE, mztab_file)

yaml_obj = list()
r <- createReport(txt_folder = NULL, mztab_file = mztab_file,  yaml_obj)
knime.flow.in[["qcreport"]] = r$report_file_HTML
knime.flow.in[["knime.workspace"]] = NULL
knime.flow.out <- knime.flow.in

It fails with my error reported in Table to R not able to load library which was unfortunately never really solved. These days on Catalina with KNIME 4.2.

Thanks

Hi @jpfeuffer,

sorry about the late response.
I guess you have already tried the solutions in the threads mentioned in your post, right?
Which version of R are you using?

There is dedicated documentation for the R integration which was created after your last post, so maybe something in your setup is missing here which could resolve the issue.

Best,
Julian

2 Likes

Forgot to post the link to the documentation:
https://docs.knime.com/2020-12/r_installation_guide/index.html

Hey Julian,

thanks for your reply. I assumed that everything is correct since the R View is working without problems and “basic” scripts work in the R Snippets work as well.

I looked a bit in the forum and in the source code and found the difference:

It seems like for some code you need to open a plotting device first to be used. If I add

require(Cairo)
options(device = 'png',bitmapType='cairo')

the snippet runs through.
I wonder if opening a device should be made standard in your R integration, since there are a lot of packages that silently try to open a device although you are not expecting them to plot anything (useful). I did not see anything popping up when running my snippet in RStudio for example. At least I think it should be noted somewhere or an option should exist in the R Snippet config dialogue.

2 Likes

Hey,

thanks for that. Looks definitely like something we could improve.
I will forward this to our developers.

Thanks again,

Julian

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.