c++ - Error while compiling RInside code -
i want compile r code using rinside. getting errors while using function read.csv. code snippet given below:
include "rinside.h" include <iomanip> include <iostream> include <fstream> include <string> include <vector> include <sstream> using namespace std; int main(int argc,char*argv[]) { rinside r(argc,argv); sexp ans; r.parseevalq("library(plotrix)"); r.parseevalq("filecontents<-read.csv("/home/nibha/manoj/test.csv")"); r.parseevalq("nr <-nrow (filecontents)"); r.parseevalq("nc <-ncol (filecontents)"); }
i getting errors follows:
: in function ‘int main(int, char**)’: prog3.cpp:14: error: ‘home’ not declared in scope prog3.cpp:14: error: ‘nibha’ not declared in scope prog3.cpp:14: error: ‘manoj’ not declared in scope prog3.cpp:14: error: ‘test’ not declared in scope prog3.cpp:20: error: ‘myfile’ not declared in scope
you have double quote "
inside double-quoted string
r.parseevalq("filecontents<-read.csv("/home/nibha/manoj/test.csv")");
so, escape backslash \
, , try again.
r.parseevalq("filecontents<-read.csv(\"/home/nibha/manoj/test.csv\")");
Comments
Post a Comment