Reputation: 1037
I've seen several threads on the error I have
cannot plot more than 10 series as "multiple"
But none really explaining (1) What's going on and (2) how to get around it if you have multiple graphs.
I have a 12 different files. Each file is 1 row of ~240-250 data points. This is time-series data. The values range changes from file to file.
I want to make a graph that has them all on one single plot. So something like par(mfrow=(4,3)).
However, when I use my code, it gives me the above error.
for(cand in cands)
{
par(mfrow=c(4,3))
for(type in types)
{
## Construct the file name
curFile = paste(folder, cand, base, type, close, sep="")
## Read in the file
ts = read.delim(curFile, sep="\t", stringsAsFactors=FALSE, header=FALSE, row.names=NULL,fill=TRUE, quote="", comment.char="")
plot.ts(ts)
}
}
Upvotes: 0
Views: 736
Reputation: 2597
First, don't call your time series object "ts". It's like calling your dog "dog". "ts" gets used in the system, and this can lead to confusion.
Have a look at the structure of your "ts" from reading the file. From your description, is the file a single row with 240+ columns? If so, that'll be a problem too.
read.delim()
is expecting a column-oriented data file, not row-oriented. You'll need to transpose it if this is the case. Something like:
my.ts = t(
read.delim(curFile, sep="\t", stringsAsFactors=FALSE,
header=FALSE, row.names=NULL,
fill=TRUE, quote="", comment.char="")
)
my.ts = ts(my.ts)
Upvotes: 2