I think that you problem is that your format statement should be "%m/%d/%Y
%H:%M";  notice the capital 'y' for a 4 digit year.  You were probably
getting NAs for dates.

Here is what I got after reading in your partial data:

> x <- read.csv('clipboard', as.is=T, header=F)
> x
         V1    V2       V3
1 3/11/2006 15:09 0.014652
2 3/11/2006 15:08 0.014652
3 3/11/2006 15:06 0.000000
> x.date <- strptime(paste(x$V1, x$V2), format="%m/%d/%Y %H:%M")
> x.date  # make sure the dates look correct
[1] "2006-03-11 15:09:00" "2006-03-11 15:08:00" "2006-03-11 15:06:00"
> plot(x.date, x$V3)
>



On 3/11/06, Richard Evans <[EMAIL PROTECTED]> wrote:
>
> Hello r-experts,
> I sure could us a little help.
>
> I have an ever updating text file with timestamped data in it. I can
> reformat in anyway I want if need be but currently I have chosen to make
> columns of date, time and measuresed value (comma delimeted and with the
> dates and times in quotes to interpret them as strings).
>
> Here is a small section of my text data file:
>
> "3/11/2006","15:09",0.014652
> "3/11/2006","15:08",0.014652
> "3/11/2006","15:06",0.000000
> ...etc...
>
> I am trying to make a plot of 'X' vs. 't'
> where 'x' is a simple numerical vector of N elemets
> and 't'   is a timestamp like "mm/dd/yyyy hh:mm:ss"
> (also of N elements)
>
> here is how i am getting the data:
> >
> >TheData <- scan("MyDataFile.txt",sep=",",list("","",0))
> >TheDates <- TheData[[1]]
> >TheTimes <- TheData[[2]]
> >TheValue <- TheData[[3]]
> >
> and here is how i am making the datetime objects:
> >
> >TimeStampStr <- paste(TheDates,TheTimes)
> >TimeStampObj <- strptime(xStamp,"%m/%d/%y %H:%M:%S")
> >
> and then i try to plot it with:
> >
> >plot(TimeStampObj,TheValues)
> >
> but this is where i get an error like this:
> >
> Read 54 records
> Error in plot.window(xlim, ylim, log, asp, ...) :
>        need finite 'ylim' values
> In addition: Warning messages:
> 1: no finite arguments to min; returning Inf
> 2: no finite arguments to max; returning -Inf
>
> Can someone help me understand what i need to do?
> Am I going about this the wrong way?
> Is there a smarter/more elegant way to do this?
>
> And advice is greatly apreciated.
>
> Sincerest thanks (in advance),
> - revansx
>
> P.S.
> here is an small section of my input file:
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>



--
Jim Holtman
Cincinnati, OH
+1 513 646 9390 (Cell)
+1 513 247 0281 (Home)

What the problem you are trying to solve?

        [[alternative HTML version deleted]]

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to