Terry Bassett
2010-May-11 13:00 UTC
[R] Problems plotting date and time column from excel using R
I am using R to read from an excel(csv) file. Within the excel file is a column with the date set that looks likes this: 53:40.2 and in the Insert function box it looks likes this: 9/21/2006 4:53:40 PM I tired separating the time and date using the function below and then plotting again which fail to read properly =TEXT(B2,"hh:mm:ss") and =TEXT(B9,"mm/dd/yyyy") The R script am using is plot.time_vs_id<- function(start,end){ setwd("C:/Documents and Settings/terry/Desktop/r_stuff") x=read.table("MAV.csv",header=T, sep=",") plot(x$time[start:end],x$packet_id[start:end],ylab="Packet ID", xlab="Time", type="p") } and plot.hov_Points <- function(start,end){ setwd("C:/Documents and Settings/terry/Desktop/r_stuff") library(rgl) t=read.table("MAV.csv",header=T, sep=",") plot3d(t$time[start:end],t$packet_length[start:end],t$date[start:end], main="potential", xlab="time", ylab="length",zlab="date", type="p") } How can i get R to properly display the time in my graphs Thanks Terry Bassett [[alternative HTML version deleted]]
David Winsemius
2010-May-11 16:30 UTC
[R] Problems plotting date and time column from excel using R
On May 11, 2010, at 9:00 AM, Terry Bassett wrote:> I am using R to read from an excel(csv) file. Within the excel file > is a column with the date set that looks likes this: > > 53:40.2 > and in the Insert function box it looks likes this: > 9/21/2006 4:53:40 PMThis is really an Excel question, rather than an R one. You need to format the data in Excel so that it gets output to the CSV properly.> > I tired separating the time and date using the function below and > then plotting again which fail to read properly > =TEXT(B2,"hh:mm:ss") and =TEXT(B9,"mm/dd/yyyy")As I said, it's an Excel question.> > The R script am using is > plot.time_vs_id<- function(start,end){ > setwd("C:/Documents and Settings/terry/Desktop/r_stuff") > x=read.table("MAV.csv",header=T, sep=",") > plot(x$time[start:end],x$packet_id[start:end],ylab="Packet ID", > xlab="Time", type="p") > } > > and > plot.hov_Points <- function(start,end){ > setwd("C:/Documents and Settings/terry/Desktop/r_stuff") > library(rgl) > t=read.table("MAV.csv",header=T, sep=",") > plot3d(t$time[start:end],t$packet_length[start:end],t > $date[start:end], main="potential", xlab="time", > ylab="length",zlab="date", type="p") > } > > How can i get R to properly display the time in my graphs > > Thanks > Terry Bassett >David Winsemius, MD West Hartford, CT
Gabor Grothendieck
2010-May-12 01:36 UTC
[R] Problems plotting date and time column from excel using R
Check out the options listed here: http://rwiki.sciviews.org/doku.php?id=tips:data-io:ms_windows On Tue, May 11, 2010 at 9:00 AM, Terry Bassett <tntbassett at yahoo.com> wrote:> I am using R to read from an excel(csv) file. Within the excel file is a column with the date set that looks likes this: > > ?53:40.2 > and in the Insert function box it looks likes this: > 9/21/2006? 4:53:40 PM > > I tired separating the time and date using the function below and then plotting again which fail to read properly > =TEXT(B2,"hh:mm:ss")?? and? =TEXT(B9,"mm/dd/yyyy") > > The R script am using is > plot.time_vs_id<- function(start,end){ > setwd("C:/Documents and Settings/terry/Desktop/r_stuff") > x=read.table("MAV.csv",header=T, sep=",") > plot(x$time[start:end],x$packet_id[start:end],ylab="Packet ID", xlab="Time", type="p") > } > > and > plot.hov_Points <- function(start,end){ > setwd("C:/Documents and Settings/terry/Desktop/r_stuff") > library(rgl) > t=read.table("MAV.csv",header=T, sep=",") > plot3d(t$time[start:end],t$packet_length[start:end],t$date[start:end], main="potential", xlab="time", ylab="length",zlab="date", type="p") > } > > How can i get R to properly display the time in my graphs > > Thanks > Terry Bassett > > > > > ? ? ? ?[[alternative HTML version deleted]] > > > ______________________________________________ > 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. > >