@mbarzyk the code is perfectly fine and in RStudio it gives the result.
Unfortunately every now and then it seems a KNIME version is screwing up the data transfer between KNIME and R. And then it takes time and convincing to sort this out.
https://forum.knime.com/search?q=%22knime.tmp.ret%22%20order%3Alatest