Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
linjiao2c
Partner - Contributor II
Partner - Contributor II

R script error in Qlik sense AAI

Hi all,

I am using SSE R plug in for a decision tree in Qlik sense.

In the sample qvf, the decision tree could be successfully generated by:

 

R.ScriptAggrExStr('SNSN',' 
library(rpart); 
library(partykit); 
library(d3r); 
library(grid);
library(jsonlite);
d3_party(rpart(survived ~ ., data=q, method="class")); 
',
sex, pclass, age_b, survived)

 

Now I want to use the generated decision tree to get the prediction result in the "Table", so I tried to use the code below:

R.ScriptEvalExStr('SNSN','  
library(rpart);  
library(partykit);  
library(d3r);  
library(grid); 
library(jsonlite); 
model<-rpart(survived ~ ., data=q, method="class");  
predict(model,type="class"); '
, sex, pclass, age_b, survived)

But it did not work, and SSEtoRserve.exe was saying:

 Error: variables 'sex', 'pclass', 'age_b' were specified with different types from the fit

Any one with some ideas about this?

Thanks in advance.

Labels (2)
1 Solution

Accepted Solutions
ckarras22
Partner - Creator
Partner - Creator

Hello,

You expect SNSN. Can you change the respective number variables in:

-->num(pclass) as pclassNumber 

-->num(survived) as survivedNumber

 

/Christos K.

View solution in original post

1 Reply
ckarras22
Partner - Creator
Partner - Creator

Hello,

You expect SNSN. Can you change the respective number variables in:

-->num(pclass) as pclassNumber 

-->num(survived) as survivedNumber

 

/Christos K.