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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Rehan
Creator III
Creator III

"R" Error

I am trying to evaluate "R" using Qlik Sense. I have already configured "R" and started the Rserve, its working fine. I am using the Demo App and getting an error 

"Rserve error: Error received from server: R parser:syntax error:

Can anyone help what am I missing

Below is the script I have 

SET inputFile='$(QvWorkPath)\data\Comorbidity Inp ICD9 BBU.csv'; // Only needed for debugging/logging purposes.
SET outputFile='$(QvWorkPath)\data\Comorbidity Index BBU.csv'; // Only needed for debugging/logging purposes.
SET RSource = '$(Must_Include=$(QvWorkPath)\R\Comorbidity v2.R)';
LET RSource = Replace(RSource, '\', '\\'); // R needs double slashes.

// Extract all known ICD-9-CM diagnosis and procedure codes for each patient from the hospital data.
[icd9cm TEMP]:
LOAD PatientID as id,
'D' & Replace(AdmitICD9DiagnosisCD,'.','') as icd9cm
Resident [Hospital]
Where AdmitICD9DiagnosisCD <> 'UNKNOWN' and NOT IsNull(AdmitICD9DiagnosisCD);
LOAD PatientID as id,
'D' & Replace(PrimaryICD9DiagnosisCD,'.','') as icd9cm
Resident [Hospital]
Where PrimaryICD9DiagnosisCD <> 'UNKNOWN' and NOT IsNull(PrimaryICD9DiagnosisCD);
LOAD PatientID as id,
'P' & Replace(PrimaryICD9ProcedureCD,'.','') as icd9cm
Resident [Hospital]
Where PrimaryICD9ProcedureCD <> 'UNKNOWN' and NOT IsNull(PrimaryICD9ProcedureCD);

icd9cm:
NoConcatenate LOAD *
Resident [icd9cm TEMP]
Order By id;

DROP Table [icd9cm TEMP];

//STORE icd9cm INTO [$(inputFile)] (txt); // Uncomment to write out for debugging/logging purposes.

// Capture the number of ICD-9-CM diagnosis and procedure codes extracted from the hospital patient data.
LET vPatientICD9CodeCount = NoOfRows('icd9cm');

[Comorbidity Scores]:
NoConcatenate
LOAD
id as PatientID,
If(index <= 3, index, 5) AS [Comorbidity Score] // index is the field returned by the medicalrisk package function generate_charlson_index_df
Extension R.ScriptEval('$(RSource)', icd9cm{id, icd9cm});

DROP Table [icd9cm];

1 Reply
somdakay
Partner - Contributor
Partner - Contributor

Hi,

Were you able to resolve this issue? I am having a similar problem.

somdakay_0-1588568771951.png

 

Thanks, Y