
> Okay, i think i solved the dates issue with your help, but hung up 
> again...  My objective is to load this panel data set (cross sectional 
> time series data) into a zoo object so i can use the time series 
> functions(like arima, spectrum, etc..) and the quantmod library.  
> However, it seems you can't have panel data in these objects, only 
> multivariate time series (basically not data that is stacked or 
> pooled, so there are multiple dates by cross-section unit).   So what 
> i do is load the zoo object by store id#, which is okay - see below.  
> I can convert to zoo, then when i try to utilize problems occur.  Zoo 
> object converts all my integer data to character, i think??
>
>
> >setwd("c:/csv")
> >d1 <- read.csv("baseline.csv",stringsAsFactors=FALSE)
> >dsmall <- 
> subset(d1[,c('total_Cases','date','Store_nbr')],Store_nbr=='177')
> >dsmall$z <- as.Date(dsmall$date, "%d%b%Y")
> >dsmallna <- na.omit(dsmall)
> >dsmallna$date <- NULL
> >str(dsmallna)
>
> 'data.frame':    414 obs. of  3 variables:
>  $ total_Cases: int  246 6502 5718 6234 853 6387 9833 6138 2405 8066 ...
>  $ Store_nbr  : int  177 177 177 177 177 177 177 177 177 177 ...
>  $ z          :Class 'Date'  num [1:414] 13770 13771 13772 13773 13774 ...
>  - attr(*, "na.action")=Class 'omit'  Named int [1:92] 415 416 417 418 
> 419 420 421 422 423 424 ...
>   .. ..- attr(*, "names")= chr [1:92] "415" "416" "417" "418" ...
>
> this looks fine, the data.frame - total_Cases is variable of interest 
> and its an integer.
>
> >dzoo <- zoo(dsmallna, dsmallna$z)
> >str(dzoo)
>
> 'zoo' series from 2007-09-14 to 2008-10-31
>   Data: chr [1:414, 1:3] "  246" " 6502" " 5718" " 6234" "  853" ...
>  - attr(*, "dimnames")=List of 2
>   ..$ : chr [1:414] "1" "2" "3" "4" ...
>   ..$ : chr [1:3] "total_Cases" "Store_nbr" "z"
>   Index: Class 'Date'  num [1:414] 13770 13771 13772 13773 13774 ...
>
> /*okay, i don't know how to interpret the structure of the zoo object, 
> Data: chr?  seems like it shifted to character? */ /*How does one 
> interpret this object - $ : chr, $ : chr? */
>
> Now lets see if i can use the zoo object for some time series work... 
> Nope all these errors, i think related to the character conversion the 
> zoo object has done?
>
> > plot(dzoo)
> i get a plot of total_Cases and store number and these errors?
>
> Error in plot.window(...) : need finite 'ylim' values
> In addition: Warning messages:
> 1: In xy.coords(x, y, xlabel, ylabel, log) : NAs introduced by coercion
> 2: In min(x) : no non-missing arguments to min; returning Inf
> 3: In max(x) : no non-missing arguments to max; returning -Inf
>
>
> >chartSeries(dzoo)
>
> Error in checkSlotAssignment(object, name, value) : assignment of an 
> object of class "character" is not valid for slot "yrange" in an 
> object of class "chob"; is(value, "numeric") is not TRUE
>
>
> >acf(dzoo)
>
> Error in acf(dzoo) : 'x' must be numeric
>
>
> -zubin
>
>
>

	[[alternative HTML version deleted]]

