Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
wenjun2016
Contributor II
Contributor II

R Qlik Integration R_BasicExample.qvf

Hi,

I am trying out the example downloaded from Qlik community about R and Qlik Sense integration. The connector is established successfully. 

I tried to load in script editor, it shows "Connector reply error: grpc::StatusCode::INVALID_ARGUMENT: 'Rserve error: The method or operation is not implemented." The output shows loaded Titanic_data.csv successfully to Titanic table, but some argument error at EchoedColumnsFromR table. I have no idea what is wrong with R.ScriptEvalStr('names(q) <- c("sex_echo", "pclass_echo", "survived_echo"); q;', Titanic{ sex, pclass, survived });

Hope anyone can help to explain what is the root cause and how to resolve it. 

I copied the script below for your reference.

Titanic:
LOAD
ID,
pclass,
survived,
sex,
"age",
age_b,
fare
FROM [lib://data/Titanic_data.csv]
(txt, utf8, embedded labels, delimiter is ',', msq);

EchoedColumnsFromR:
Load * Extension R.ScriptEvalStr('names(q) <- c("sex_echo", "pclass_echo", "survived_echo"); q;', Titanic{ sex, pclass, survived });

// Here you can also see how the fields can be renamed after you get them from R.
EchoedColumnsFromRrenamed:
Load
ID as ID,
sex as sex_echoed,
pclass as pclass_echoed
Extension R.ScriptEvalStr('data.frame(q);', Titanic{ sex, pclass, ID });

// Return a table from R (in one call to to the R plugin) with two columns: SumOfRow, MulOfRow
SumAndMulOfRowFromRscript:
Load * Extension R.ScriptEval('q$SumOfRow = q$pclass+q$survived; q$MulOfRow = q$pclass*q$survived; qRes <- within(q, rm(pclass, survived)); qRes;', Titanic{ pclass, survived });

// If you have defined your own functions in the R plugin (FuncDefs.json) then you can call the function below instead of the script variant above
// SumAndMulOfRowFromRfunction:
// Load
// SumOfRow as sum_pclass_survived,
// MulOfRow as product_pclass_survived
// Extension R.SumAndMulOfRow(Titanic{ pclass, survived });

Table1:
LOAD * INLINE [
IDT1, String, MyNumber
0, "a", 10
1, "b", 11
2, "c", 12
3, "d", 13
];

ScalarLoadFromRscript:
Load
IDT1 as IDT1,
// SSE call with the script function 'ScriptEval' passing the ID variable to the plugin
// Note that the SSE call is scalar from the load script, hence there will be 4 calls (in this case) to the plugin.
R.ScriptEval('q$IDT1 + 10000;', IDT1) as IDT1FromR
Resident Table1;

1 Reply
Anonymous
Not applicable

Hi, please try v1.2.1 of SSE Plug in.

It Works for me

More information;  https://support.qlik.com/articles/000052026