R Snippet (R/Local/R Snippet) interprets strings as doubles? Example attached

Dear KNIME,

 

I've a problem with the attached workflow where I suspect there's a bug in the workflow.  It's difficult to explain without one opening the workflow, but here's what I can summarise:

 

- input = a set of double datatype columns

- process = the row of each double column with the maximum value has the character "m" appended to it & output

- problem - R/Local/R Snippet interprets the output column as double datatype even though there's a string value - it should be output as a String datatype! 

Strangely (as attached) the Knime Labs "Table to R" then "R to Table" does this correctly.  Also, the R/Local/R Snippet interprets the column as a string when there are 2 (not 1) rows with characters in them.

 

Very specific bug (unless it's an intended feature?) but significant nevertheless IMO

Ed.

 

 

Ed.

Hi Ed, 

If you notice the nodes in your examples have different Icons, then are actually from different extensions.  If you add a new R Snippet node, it will have the new icon, and you can then use something like:

BEDROCS.R <- apply(knime.in, 2, function(cols) {
  max.index <- which( max(cols) == cols )
  cols[ max.index ] <- paste( cols[ max.index ], "m", sep="" )

  as.character(cols)
} )

knime.out <- data.frame(BEDROCS.R)

Aaron,

 

Yeah I know they're different extensions - I don't understand why they're behaving differently in this instance, hence why I'm reporting this.

 

Ed.

Does the problem persist in the current integration? If so, I can investigate further.  

Aaron,

 

I'm using KNIME 2.9.4.  I'm not using quite the latest version although I have a colleage who does - I can ask him.  I doubt there'll be a difference though.

 

Ed.

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