--- Samuel Okoye <[EMAIL PROTECTED]> wrote:

> Hello,
>    
>   if we suppose that
>    
>   times <- c("2006-05-14", "2006-06-12",
> "2006-06-12", "2006-05-14", "2006-05-14",
> "2006-06-12")
>   value <- c(2,3,1,4,3,1)
>    
>   then with
>    
>   plot(times, value)

Have you tried this?

I think you mean
boxplot( value ~ times)
>    
>   we have two boxplots in one graph for 2006-05-14
> and 2006-06-12 respectively! Is it possible to have
> them in a scatterplot? 

I don't see how since time is a character variable.
However if you do 
times <- as.Date (c("2006-05-14", "2006-06-12",
 "2006-06-12", "2006-05-14", "2006-05-14",
 "2006-06-12")) 
then you can. 
> and if I sort the data as
>    
>   x <- data.frame(times, value)
>   x <- x[order(times),]
>    
>   Is it possible to create a new variable which
> contains 1 for 2006-05-14 and 2 for 2006-06-12?
>    
y <-  ifelse(x[,1]=="2006-05-14", 1 , 2)
 x <- cbind(x,y) ; x

It was not clear exactly what you wanted to plot so
this may be closer to what you wanted than converting
to as.Date and ploting


 plot(x[,3],x[,2], col="red",xaxt="n", xlab="times",
ylab="value")
 axis(side=1, at=c(1,2), labels=c("2006-06-12", "2006-06-12"))

______________________________________________
[email protected] 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