Error: $ operator is invalid for atomic vectors - 해결방법

CODEDRAGON Development/Big Data, R, ...

반응형

 

 

 

 

오류 메시지

> n_r <- prediction(testData$net_pred, testData$case)
Error: $ operator is invalid for atomic vectors

>

 

 

 

 

오류 원인

prediction()함수가 패키지와 패키지에 동일하게 존재하여 함수 호출시 충돌이 일어나기 때문에 발생합니다.

 

> help(prediction)

>

 

Help on topic 'prediction' was found in the following packages:

Summarizes the output of the neural network, the data and the fitted values of glm objects (if available)

(in package neuralnet in library C:/Users/prons/Documents/R/win-library/3.4)

Function to create prediction objects

(in package ROCR in library C:/Users/prons/Documents/R/win-library/3.4)

 

 

 

 

해결방법

패키지를 사용하기 위해 library()함수로 패키지 로드를 하는데

사용하고자 하자는 패키지 말고 현재 사용하지 않는 패키지는 detach()함수로 로드된 패키지를 해제합니다.

 

> detach(package:neuralnet)

>

 

> detach(package:ROCR)

>

 

 

 

 

 

 

반응형