Hi,
You didn't provide a reproducible example.  If your dataset is something like 
this:
set.seed(495)
DataSeries <- data.frame(Date=seq(as.Date("2001-01-01"),by="1 day", 
length.out=20), A= sample(10,20,replace=TRUE), B= rnorm(20))


###Using your codes:

Matrix_New1 <- 
cbind(as.list(DataSeries[,"Date"]),as.list(DataSeries[,"A"]),colnames(DataSeries)[2])

Matrix_New2 <- 
cbind(as.list(DataSeries[,"Date"]),as.list(DataSeries[,"B"]),colnames(DataSeries)[3])

str(Matrix_New1)
#List of 60
str(Matrix_New2) 

#List of 60 

Matrix_Complete<- rbind(Matrix_New1,Matrix_New2)
str(Matrix_Complete)
#List of 120
Col_Names_MC<-c("X","Y", "Z")
colnames(Matrix_Complete)<-Col_Names_MC 

library(lattice) 

Plot_AB<-xyplot(Y~ X, data =Matrix_Complete, type =c("l"), groups=Z, 
as.table=TRUE, main="Development over time")
#Error in eval(expr, envir, enclos) : object 'Z' not found 

#You could try:
library(reshape2)
 DataSeriesM <- setNames(melt(DataSeries,id.var="Date"),LETTERS[c(24,26,25)])
 xyplot(Y~X,data=DataSeriesM,type="l",groups=Z,as.table=TRUE,main="Development 
over time")
 #for a numeric X axis
 
xyplot(Y~as.numeric(X),data=DataSeriesM,type="l",groups=Z,as.table=TRUE,main="Development
 over time") 
# with legends
 
xyplot(Y~as.numeric(X),xlab="X",data=DataSeriesM,type="l",groups=Z,as.table=TRUE,main="Development
 over time",auto.key=list(x=.85, y=.95, border=TRUE,lines=TRUE)) 


Hope it helps.

A.K.


Hi everbody, I have the following error message occuring when I run my code:
"Error in eval(expr, envir, enclos) : object 'Series' not found" The code I am 
using is the following: Matrix_New1 <- 
cbind(as.list(DataSeries[,"Date"]),as.list(DataSeries[,"A"]),colnames(DataSeries)[2]
 )
Matrix_New2 <- 
cbind(as.list(DataSeries[,"Date"]),as.list(DataSeries[,"B"]),colnames(DataSeries)[3]
 ) #whereas first and second columns should be numbers, third column is "A" and 
"B" respectively Matrix_Complete<- rbind(Matrix_New1,Matrix_New2) 
Col_Names_MC<-c("X","Y", "Z")
colnames(Matrix_Complete)<-Col_Names_MC Plot_AB<-xyplot(Y~ X, data 
=Matrix_Complete, type =c("l"), groups=Z, as.table=TRUE, main="Development over 
time") print(Plot_AB) Can you explain me why this way of creating a plot is not 
working and what I Need to Change in order to be able to plot it? 


______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to