1
쉘에서 R 스크립트를 호출하려고합니다.쉘에서 R 스크립트 실행
스크립트는 다음과 같습니다 : 내가 얻을
Rscript scriptName fileName
: 쉘에서이 스크립트를 호출, 그러나
1 2 1 2 4
2 4 5 4 2
1 2 3 4 5
:
functionName <- function(file1){
args <- commandArgs(trailingOnly = TRUE)
print(args)
data <- read.table(file(file1),row.names=1,header=FALSE,sep='\t',dec='.')}
functionName(args[1])
내 파일 1과 같은 수의 행이 포함 다음 오류 :
Error in args[1] : object of type 'closure' is not subsettable
Calls: processGroups -> read.table -> file
Execution halted
누구든지이 오류 메시지가 의미하는 것을 설명 할 수 있습니까?
'클로저'가 R의 함수 유형 ('help ("closure") 참조) 인 경우, 즉 데이터 객체가 아닌 경우이 오류 메시지를 이해하는 데 도움이됩니다. – Roland