# Using character input (e.g., raw from CSV)
app_names <- c("foo", "foo,bar")
app_values <- c(
"1000,2000,1,3000,4000,2",
"4000,5000,3,6000,7000,4,8000,9000,5,10000,11000,6"
)
extract_app_usage(app_names, app_values)
# Using list-column input (e.g., from read_mpath())
app_names <- list("foo", c("foo", "bar"))
app_values <- list(
c(1000,2000,1,3000,4000,2),
c(4000,5000,3,6000,7000,4,8000,9000,5,10000,11000,6)
)
extract_app_usage(app_names, app_values)
# You can also use this function within a tidyverse pipeline:
library(dplyr)
tibble(app_name = app_names, app_value = app_values) |>
mutate(usage = extract_app_usage(app_name, app_value))
Run the code above in your browser using DataLab