date

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

date

Samuel Okoye
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

       
---------------------------------

______________________________________________
[hidden email] 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 | Threaded
Open this post in threaded view
|

Re: date

jholtman
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 <[hidden email]> 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
>
>
> ---------------------------------
>
> ______________________________________________
> [hidden email] 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?

______________________________________________
[hidden email] 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 | Threaded
Open this post in threaded view
|

Re: date

Don MacQueen
In reply to this post by Samuel Okoye

At 7:25 AM -0700 9/26/07, Samuel Okoye 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?
>

Not without more information.

(for example, the full text of the error message; you should also use
traceback(), verify that MyData$times has the class you expected,
ditto for MyData$value)

Please take a look at the posting guide.

>   Thanks alot,
>   Samuel
>
>      
>---------------------------------
>
>______________________________________________
>[hidden email] 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.

-Don
--
--------------------------------------
Don MacQueen
Environmental Protection Department
Lawrence Livermore National Laboratory
Livermore, CA, USA
925-423-1062

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