#' Read time tracking data in CSV format
#'
#' @param file_in file to plot
#' @param tzone time zone for the locale, and in the case of timetrackIO, for forcing
#' @importFrom magrittr %>%
#' @importFrom rlang .data
#' @export
time_1read <- function(file_in, tzone = "Australia/Adelaide"){
# Read in data as string, and collapse on line breaks
df_in <- readr::read_csv(
file_in,
locale = readr::locale(tz = tzone),
col_names = c("start_dttm", "activity", "notes"),
col_types = readr::cols(
start_dttm = readr::col_datetime("%F %R %z"),
activity = "c",
notes = "c"
)
)
df_in %>%
# Replace blank notes with empty string, not NA
tidyr::replace_na(list(notes = "")) %>%
# Add end_dttm as a separate variable
dplyr::mutate(end_dttm = dplyr::lead(.data$start_dttm)) %>%
dplyr::slice(-n()) %>%
# Add indicator to check that rows are ordered correctly
dplyr::mutate(ind_row_order = .data$start_dttm < .data$end_dttm)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.