On Apr 29, 2010, at 10:14 AM, Carol Gao wrote:

Appreciate it! I was trying on the code you sent, then some error codes
turned up:

The first line runs ok, the second line:

modifyList(Time2, list(hour = Time2$hour + 11))
Error in Time2$hour : $ operator is invalid for atomic vectors

The time format I used for reading the Time vector is "%d-%b-%Y %H: %M:%OS".

It appears you have already created a datetime object from a read operation on that csv file, in which case adding 11 hours should be straightforward.

Time.plus.11hr <- Time + 11*60*60

--
David

Should I change any code above?

Carol



On Thu, Apr 29, 2010 at 11:47 PM, Henrique Dallazuanna <www...@gmail.com >wrote:

Try this:

Time2 <- gsub("\\.*", "", tolower(Time))
modifyList(Time2, list(hour = Time2$hour + 11))


On Thu, Apr 29, 2010 at 10:33 AM, Carol Gao <carol.g...@gmail.com> wrote:

Hi there,

I've got a column vector in a csv file as follows, and I need to add 11 hours to each of them. Is there a way that I can do it? (The actual file
size is much bigger than this.)

Time
"01-DEC-2008 00:00:28.611"
"01-DEC-2008 00:00:43.155"
"01-DEC-2008 00:01:06.677"
"01-DEC-2008 00:01:06.677"
"01-DEC-2008 00:01:06.677"
"01-DEC-2008 00:01:06.919"
"01-DEC-2008 00:23:46.452"
"02-DEC-2008 00:03:17.646"
"02-DEC-2008 00:03:17.652"
"03-DEC-2008 00:15:11.485"
"03-DEC-2008 00:18:44.652"
"03-DEC-2008 00:22:17.447"

Thank you in advance.

Cheers,

Carol

      [[alternative HTML version deleted]]

______________________________________________
R-help@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.




--
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O


        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

David Winsemius, MD
West Hartford, CT

______________________________________________
R-help@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.

Reply via email to