1
votes

I have a variable, time, that is in Hour-Second-Minute format.

time <- "01:01:52"

I want to have a new time-format variable, time2.

I try:

strptime(db[1,10], format = "%H:%M:%S")

This returns

"2014-01-30 01:01:52"

How do I get rid of the Year-Month-Date portion of this?

I have absolutely no attachment to the "POSIXlt" or "POSIXt" classes. I am trying to plot a bunch of times on a histogram. Can I use ggplot2 to do so? If not, what is the best way to plot times?

1

1 Answers

2
votes

Have a look at the ggplot2 scale_x_datetime example:

http://docs.ggplot2.org/0.9.3.1/scale_datetime.html

the examples will show you ways to format as time only.