Changed return value for create_eventlogs from tibble to data frame

This commit is contained in:
Nora Wickelmaier 2024-05-02 19:46:29 +02:00
parent c3ae475d71
commit 05a8dbe689

View File

@ -35,7 +35,7 @@ add_path_items <- function(subdata) {
} }
subdata_list <- pbapply::pblapply(items, path_per_item, subdata = subdata) subdata_list <- pbapply::pblapply(items, path_per_item, subdata = subdata)
subdata <- dplyr::bind_rows(subdata_list) subdata <- as.data.frame(dplyr::bind_rows(subdata_list))
# Remove popup events that occur after item has been closed # Remove popup events that occur after item has been closed
subdata <- subdata[!is.na(subdata$path), ] subdata <- subdata[!is.na(subdata$path), ]
@ -139,7 +139,7 @@ add_path_moves <- function(data, cutoff) {
subdata_path <- pbapply::pblapply(subdata_item, subdata_path <- pbapply::pblapply(subdata_item,
add_path_subdata, cutoff = cutoff) add_path_subdata, cutoff = cutoff)
out <- dplyr::bind_rows(subdata_path) out <- as.data.frame(dplyr::bind_rows(subdata_path))
out <- out[order(out$fileId.start, out$date.start, out$timeMs.start), ] out <- out[order(out$fileId.start, out$date.start, out$timeMs.start), ]
# Make path a consecutive number # Make path a consecutive number
out$path <- as.numeric(factor(out$path, levels = unique(out$path))) out$path <- as.numeric(factor(out$path, levels = unique(out$path)))
@ -216,7 +216,7 @@ add_path_subdata <- function(subdata, cutoff) {
} }
subdata_path <- lapply(subdata_moves, check_moves, cutoff = cutoff) subdata_path <- lapply(subdata_moves, check_moves, cutoff = cutoff)
subdata <- dplyr::bind_rows(subdata_path) subdata <- as.data.frame(dplyr::bind_rows(subdata_path))
if (nrow(subdata) != 0) { if (nrow(subdata) != 0) {
subdata$path <- as.factor(subdata$path) subdata$path <- as.factor(subdata$path)
} }