Ok, so R was correctly initialized, but then terminated for some unknown reason. Can you replace the line

Rx("rm(list = ls());");

with

RExecute(hR,"rm(list = ls());");
printf("\n%s",RLastOutput(hR));
if(!RIsRunning(hR)) {
printf("\nR stopped!");
return;
} else
printf("\nR still running...");

and let me know what it prints?