开发者

Error while compiling RInside code

I want to compile a R code using RInside. But I am getting errors while using the function read.csv. The code snippet is 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 am getting the开发者_如何学Python errors as follows:

: In function ‘int main(int, char**)’:  
prog3.cpp:14: error: ‘home’ was not declared in this scope  
prog3.cpp:14: error: ‘nibha’ was not declared in this scope  
prog3.cpp:14: error: ‘manoj’ was not declared in this scope  
prog3.cpp:14: error: ‘test’ was not declared in this scope  
prog3.cpp:20: error: ‘myfile’ was not declared in this scope  


You have double quote " inside double-quoted string

R.parseEvalQ("fileContents<-read.csv("/home/nibha/manoj/test.csv")"); 

So, just escape it with backslash \, and try again.

R.parseEvalQ("fileContents<-read.csv(\"/home/nibha/manoj/test.csv\")"); 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜