Skip to content

Commit

Permalink
date format recognition in Actigraph files expanded to also handle hy…
Browse files Browse the repository at this point in the history
…phen separators rather than only forward slash separators
  • Loading branch information
vincentvanhees committed Jun 5, 2017
1 parent 08937d0 commit f7cd69b
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions R/g.getstarttime.R
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,27 @@ g.getstarttime = function(datafile,P,header,mon,dformat,desiredtz,selectdaysfile
B3 = length(unlist(strsplit(topline,"dd[.]MM[.]yyyy")))
B4 = length(unlist(strsplit(topline,"d[.]M[.]yyyy")))
if (B1 > 1) {
starttime = as.POSIXlt(starttime,format='%m/%d/%Y %H:%M:%S')
starttime0 = as.POSIXlt(starttime,format='%m/%d/%Y %H:%M:%S')
if(is.na(starttime0) == TRUE) {
starttime0 = as.POSIXlt(starttime,format='%m-%d-%Y %H:%M:%S')
}
} else if (B2 > 1) {
starttime = as.POSIXlt(starttime,format='%m/%d/%Y %H:%M:%S')
starttime0 = as.POSIXlt(starttime,format='%m/%d/%Y %H:%M:%S')
if(is.na(starttime0) == TRUE) {
starttime0 = as.POSIXlt(starttime,format='%m-%d-%Y %H:%M:%S')
}
} else if (B3 > 1) {
starttime = as.POSIXlt(starttime,format='%d/%m/%Y %H:%M:%S')
starttime0 = as.POSIXlt(starttime,format='%d/%m/%Y %H:%M:%S')
if(is.na(starttime0) == TRUE) {
starttime0 = as.POSIXlt(starttime,format='%d-%m-%Y %H:%M:%S')
}
} else if (B4 > 1) {
starttime = as.POSIXlt(starttime,format='%d/%m/%Y %H:%M:%S')
starttime0 = as.POSIXlt(starttime,format='%d/%m/%Y %H:%M:%S')
if(is.na(starttime0) == TRUE) {
starttime0 = as.POSIXlt(starttime,format='%d-%m-%Y %H:%M:%S')
}
}
starttime = starttime0
lengthheader = 9
}
}
Expand Down

0 comments on commit f7cd69b

Please sign in to comment.