0

I have imported data from an excel worksheet. one column has dates/periods in mm/dd/yy format.

I have multiple worksheets. So I used lst = readWorksheet(wb, sheet = getSheets(wb))to import the worksheets and a list is created.

I then converted the first worksheet into a dataframe

klrm=as.data.frame(lst$Arst)

But the first column which is the date column comes up as date and has 00:00:00 attached with it.

I checked this variable and it was a character variable.

Could someone help me remove those 00:00:00 ?

Freewill
  • 413
  • 2
  • 6
  • 18
  • 1
    You need to specify the package used and also a reproducible example. http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example – akrun Feb 04 '15 at 04:15
  • The package used to import the file was XLConnect. How would I produce a reproducible example of this - I listed the code I used to import the excel file and create the dataframe already – Freewill Feb 04 '15 at 14:48

1 Answers1

1

in your readWorksheet call, you could try:

lst = readWorksheet(wb, sheet = getSheets(wb), dateTimeFormat = "%Y-%m-%d")

I found an example here which includes the time portion in the datetime format: http://www.inside-r.org/packages/cran/XLConnect/docs/readWorksheet

So, try setting the format for just year-month-day.

rstruck
  • 1,174
  • 4
  • 17
  • 27