twitter / AnomalyDetection

Anomaly Detection with R
GNU General Public License v3.0
3.55k stars 776 forks source link

csv import #41

Closed Pascougnou closed 9 years ago

Pascougnou commented 9 years ago

Hello

I might be asking a dumb question but I tried to use my brain and it failed ;-) When trying to use the library I import data from a .csv (data_raw <- read.csv(file = file_name, header = FALSE, sep = "," ). I get a table with two rows, one containing a timestamp and the second a value.

My problem is whenerver I try res = AnomalyDetectionTs(data_raw, max_anoms=0.02, direction='both', plot=TRUE or res = AnomalyDetectionVer(data_raw[1], max_anoms=0.02, direction='both', plot=TRUE I get Error in Summary.factor(1:339, na.rm = FALSE) : ‘max’ not meaningful for factors

LJTURNER commented 6 years ago

Hi @Pascougnou - I realise this thread was initiated some time ago now, however I am finding that I come across the same error when trying to run the anomaly detection on data I have imported from a tab delimited text file.

I also have a table consisting of a timestamp and the value I want to test.

Did you encounter a solution to this? I'd appreciate any help, as I am a relatively inexperienced R user.

Many Thanks!

LJTURNER commented 6 years ago

An update for those viewing this post - my mistake was to bring in stringsAsFactors=TRUE, changing this to FALSE resolves the issue.

UK <- read.csv("C:/Temp/UK.txt", stringsAsFactors=FALSE)

Pascougnou commented 6 years ago

Hi @LJTURNER some time ago indeed ;-)

I was looking through my files but you were quicker. Thanks.