One option is to change your data so that you have a column for each State-County combination. This allows you to build the xts matrix:
require(reshape) Opt1 <- as.data.frame(cast(Data, Date ~ county + State, value="Val")) rownames(Opt1) <- Opt1$Date Opt1$Date <- NULL as.xts(Opt1)
Alternatively, you can work with the list of xts objects, each time checking that you have the correct format specified by xts. The same goes for any other package package. Possible Solution:
Opt2 <- with(Data, by(Data,list(county,State,year), function(x){ rownames(x) <- x$Date x <- x["Val"] as.xts(x) } ) )
Which will allow something like:
Opt2[["d","b","2012"]]
to select a specific time series. You can use all xts options. You can scroll through counties, states, and years to build graphs like this:

Code for the plot:
counties <- dimnames(Opt2)[[1]] states <- dimnames(Opt2)[[2]] years <- dimnames(Opt2)[[3]] op <- par(mfrow=c(3,6)) apply( expand.grid(counties,states,years),1, function(i){ plot(Opt2[[i[1],i[2],i[3]]],main=paste(i,collapse="-")) invisible() } ) par(op)
Test data:
Data <- data.frame( State = rep(letters[1:3],each=90), county = rep(letters[4:6],90), Date = rep(seq(as.Date("2011-01-01"),by="month",length.out=30),each=3), Val = runif(270) ) Data$year <- as.POSIXlt(Data$Date)$year + 1900