Displaying 1 result from an estimated 1 matches for "tfact".
Did you mean:
fact
2009 Aug 18
1
Applying Logical statement to DateTime string as factor
...ime), function(x)
strsplit(x," "))),ncol=4, byrow=TRUE) #Break Time String into columns
colnames(new.dates) <- c("day","month","year", "time") # Set column names
dat <- cbind(as.data.frame(new.dates), as.data.frame(dat)) #bind to data
frame
tfact<-matrix()
for (i in which(as.character(dat$time) <= "12:00:00")){
tfact[i] <- "Morning"
}
for (i in which(as.character(dat$time) >= "12:00:00")){
tfact[i] <- "Night"
}
tfact<-factor(tfact,
levels=c("Morning",...