You have succeeded, but you just don't know it. The POSIXct object is
representing that instant of time internally... you are just complaining about
how it is printing it. So convert it to character explicitly with the desired
format when you want to print it.
as.character( my.bastimeToSynoptic
Hello all:
I wrote a function:
my.bastimeToSynoptic <- function(x) {
f<-unlist(strsplit(as.character(x), " "))
hr<-unlist(strsplit(f[2], ":"))
if(as.numeric(hr[1])<6) {
synoptic<-"00"
}
else {
synoptic<-as.integer(as.numeric(hr[1])/6)*6
}
tdate<-paste(c
2 matches
Mail list logo