2011-02-18 6 views
2

RInside를 사용하여 R 코드를 컴파일하려고합니다. 하지만 read.csv 함수를 사용하는 동안 오류가 발생합니다. 단지 탈출 당신은RInside 코드를 컴파일하는 중 오류가 발생했습니다.

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

그래서 이중 인용 된 문자열 내부에 큰 따옴표 "

: 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 
+0

난 당신이 콘솔에서 찾고 전의 c.If에는 배경이없는 생각, 당신은 "gedit에서"(텍스트 편집기) 착색 단어 이상의 무언가를 말하려고 것을 깨닫게한다. –

+0

R 코드를 컴파일하지 않고 C++ 코드에만 포함 시키십시오. 이렇게하면 더 빠르게 작동하지 않습니다. – mbq

답변

1

을 다음과 같이 나는 오류를 얻고있다

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)"); 
} 

: 코드 조각은 아래와 같습니다 백 슬래시로 \을 입력하고 다시 시도하십시오.

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

감사 마크. 그건 놓칠 바보 같은 짓 이었어. 그것의 일 벌금. – Manoj