suppressPackageStartupMessages({
  library(kableExtra)
  library(rtrackr)
  library(networkD3)
})

Setting up

Below is an example of a more complicated workflow, starting from multiple input files, to be used as an example of a full rtrackr workflow.

We will define and log simple dataframes for this example. For more information, please see getting started and summarising data.

trackr_dir <- '~/Documents/Personal/trackr_dev/trackr_dir'

df1 <- data.frame(a = c('a', 'b', 'c'), b = c(1, 2, 3))
df2 <- data.frame(a = c('a', 'b', 'c'), b = c(4, 5, 6))

Details 1 df1

kable(df1) %>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"))

Details 2 df2

kable(df2) %>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"))

df1 <- trackr_new(df1, trackr_dir = trackr_dir, timepoint_message = 'Start', suppress_success = TRUE)
df2 <- trackr_new(df2, trackr_dir = trackr_dir, timepoint_message = 'Start', suppress_success = TRUE)

Details 1 df1

kable(df1) %>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"))

Details 2 df2

kable(df2) %>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"))

Workflow

df <- rbind(df1, df2)

df <- df %>% dplyr::group_by(a) %>% 
  trackr_summarise(n = dplyr::n())

Details

kable(df) %>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"))

df <- trackr_timepoint(df, trackr_dir = trackr_dir, timepoint_message = 'processing 1', suppress_success = TRUE)

Details

kable(df) %>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"))

df <- df %>% 
  dplyr::mutate(n = n + 20)

df <- trackr_timepoint(df, trackr_dir = trackr_dir, timepoint_message = 'processing 1', suppress_success = TRUE)

Details

kable(df) %>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"))

Results

Inspect the full processing chain of a single record with trackr_lineage() and trackr_network(). For more information, please see getting started. Note that this record has two "root" records (it is the child of two starting points in the processing chain).

target_id <- df$trackr_id[1]
trackr_lineage(target_id, trackr_dir)

lineage_fn <- paste0(trackr_dir, '/', target_id, '_lineage.json')

trackr_network(lineage_fn)

Clean up

clean_trackr_dir(trackr_dir)

Article by Hamish Gibbs r Sys.time(). To report a problem with this package, please create an issue on GitHub.



hamishgibbs/rtrackr documentation built on June 25, 2020, 8:16 p.m.