1

i have a vector with POSIXct values

time.from <- as.POSIXct('2015-01-01 00:00')
time.to <- as.POSIXct('2015-01-02 00:00')  
time.diff <- as.difftime(75,units='mins')
time.V <- seq(from=time.from,to=time.to, by=time.diff)

when i do for loop the values are turned into numerics

for (time.i in time.V) {
  print(time.i)
  print(class(time.i))  
}

we get numerics

[1] 1420169400 [1] "numeric"

just to check:

print(time.V)

[1] "2015-01-01 00:00:00 EST" "2015-01-01 01:15:00 EST" "2015-01-01 02:30:00 EST" ...

print(class(time.V))    

[1] "POSIXct" "POSIXt"

the question is how do i fix this? and more important why is this happening?

p.s. sorry for the formatting

pes
  • 56
  • 4

0 Answers0