#' getBatInteract
#'
#' @param filename name of file where pdk-device-battery is stored (txt).
#' @param desiredtz timezone (character) in Europe/London format
#' @return timestamps (POSIX) on which the battery was either being connected or unplugged.
#' @export
getBatInteract = function(filename, desiredtz) {
bat = data.table::fread(file=filename,sep="\t")
bat = as.data.frame(bat)
bat = replaceVarWithSpace(bat)
bat = addPOSIX(bat, desiredtz)
plugged = bat$Plugged != "unknown"
batInteract = which(abs(diff(plugged)) != 0)
batInteractTimes = bat$Created.Date.POSIX[batInteract]
# x11() # Create plot to QC event detection
# plot(bat$Created.Date.POSIX,bat$Level,type="l",ylab="battery level")
# lines(bat$Created.Date.POSIX[batInteract],bat$Level[batInteract],type="p",col="red",pch=20)
return(batInteractTimes)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.