cancel
Showing results for 
Search instead for 
Did you mean: 

R-Apriori - Interpretation of numerical items as string

former_member259476
Participant
0 Kudos

Hello everybody,

is there an easy way within PA to force R to interpret a 4 digit number as a string instead of a number?

Background: When I select a numerical column as item for the R-Apriori-Algorithm following error occurs:

    java.lang.Throwable: An error occurred while
    executing commands in the R environment. Error from R: "Error in
    asMethod(object) : column(s) 3 not logical or a factor. Use as.factor or
categorize first. "

 

This happens always if the regarding column contains only digits and no characters, independently of whether I configured PA to interpret the column as an integer or as a string.

Thanks for help.

Accepted Solutions (1)

Accepted Solutions (1)

AndreasForster
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Jan,

you can try putting a 'data type definition' component in front of the apriori. This allows you to ensure the data type is string.

Greetings

Andreas

former_member259476
Participant
0 Kudos

Hi Andreas,

thanks for your quick response.

Unfortunately putting a 'data type definition' in front of Apriori to change the column's type to string does not help. Still the same error message.

I tested a lot today and it feels like R is always interpreting a column that only contains digits as an integer automatically, independent of the data type definition.

Regards,

Patrick

AndreasForster
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hm, that is a strange behaviour. Are you on the latest version 1.0.11?

As a mean workaround you could try using a formula to add some character to the number. Then use the formula as input for the Apriori.

Greetings

Andreas

former_member259476
Participant
0 Kudos

Hi Andreas,

yes, I'm on Version 1.0.11.

Your workaround is working when I use the CONCAT-Formula to append a character to the number.

I tried several String Functions but only the CONCAT is working for me and it's only working if I add a char. Concatenating the number with a space is not working which in my opinion underlines that R interprets the input data on some level I cannot influence when using PA.

Since I should be fine with this workaround I'll mark this discusson as answered. Thanks again for your help.

Regards

Patrick

Answers (0)