[R] Converting time from HH:MM:SS to only HH:MM

Rolf Turner r.turner at auckland.ac.nz
Tue Mar 17 23:51:03 CET 2009


On 18/03/2009, at 11:34 AM, Neotropical bat risk assessments wrote:

> Hi all,
>
> I need to compare between times and put all similar times in specific
> 1 minute bins.
> Unfortunately the original data include seconds as well.
>
> My data is in HH:MM:SS format but I need it rounded to only HH:MM and
> trying in Excel to display "unique" records only does not work since
> the seconds are not unique.
>
> Is there an easy way using perhaps CHRON to change all from the
> HH:MM:SS data to a new HH:MM only data set and save as a TXT or CSV  
> file?

Doesn't

	as.character(xxx,format="%H:%M")

(where ``xxx'' is your data) do what you want?  You can then save the  
result
to a txt or csv file in whatever manner suits you; sink(), write(),  
write.table(),
write.csv(), ....

	cheers,

		Rolf Turner

######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}




More information about the R-help mailing list