[R] date
jim holtman
jholtman at gmail.com
Wed Sep 26 21:52:44 CEST 2007
What is the error message? What does 'str(MyData)' show? I read your
data in and it worked fine.
> x <- read.table(textConnection(" name value times
+ 1 A1 2 2006-05-12
+ 2 A2 3 2006-05-16
+ 3 A3 1 2006-05-12
+ 4 A4 4 2006-05-12
+ 5 A5 2 2006-05-16
+ 6 A6 1 2006-05-12"), header=TRUE)
> str(x)
'data.frame': 6 obs. of 3 variables:
$ name : Factor w/ 6 levels "A1","A2","A3",..: 1 2 3 4 5 6
$ value: int 2 3 1 4 2 1
$ times: Factor w/ 2 levels "2006-05-12","2006-05-16": 1 2 1 1 2 1
> x$times <- as.POSIXct(as.character(x$times))
> str(x)
'data.frame': 6 obs. of 3 variables:
$ name : Factor w/ 6 levels "A1","A2","A3",..: 1 2 3 4 5 6
$ value: int 2 3 1 4 2 1
$ times:'POSIXct', format: chr "2006-05-12" "2006-05-16"
"2006-05-12" "2006-05-12" ...
> plot(x$times, x$value) # works fine
On 9/26/07, Samuel Okoye <samuoko at yahoo.com> wrote:
> Hello,
>
> I have got the following problem:
>
> > setwd("C:/temp")
> > library(xlsReadWrite)
> > MyData <- read.xls(file="Mappe1.xls", colNames = TRUE,dateTimeAs = "isodatetime")
> > attach(MyData)
> > MyData
> name value times
> 1 A1 2 2006-05-12
> 2 A2 3 2006-05-16
> 3 A3 1 2006-05-12
> 4 A4 4 2006-05-12
> 5 A5 2 2006-05-16
> 6 A6 1 2006-05-12
> > plot(times,value)
> Error........
>
> Could you help me please?
>
> Thanks alot,
> Samuel
>
>
> ---------------------------------
>
> ______________________________________________
> R-help at 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.
>
>
--
Jim Holtman
Cincinnati, OH
+1 513 646 9390
What is the problem you are trying to solve?
More information about the R-help
mailing list