library(datavyu)
library(tidyverse)
# find_unique_values("ex-data/datavyu_output_07-06-2020_14-46", what = "codes")[1]

f <- datavyur::datavyu_search(folder = "data/datavyu_output_03-15-2021_10-40") %>% as_tibble()

f$column %>% unique()
## [1] "LogClass_AS_ActivityFormat"      "LogClass_AS_ParticipationFormat"
## [3] "LogClass_AS_TeacherPrompt"       "LogClass_IG"                    
## [5] "LogClass_IS"                     "LogClass_IT"                    
## [7] "LogClass_TO_MathPresent"         "LogClass_TaskUsed"
f$file %>% unique()
## [1] "EP 15-02-26 T602 Content Log Spinup Updated"
options(directory = "data/datavyu_output_03-15-2021_10-40")

Summarizing a column

{datavyu} can help to summarize a column. It defaults to summarizing the frequency of codes for a specified column.

summarize_column(column = "LogClass_AS_ActivityFormat",
                 code = "code01")
## # A tibble: 4 x 3
##   code01     n percent
## * <chr>  <dbl>   <dbl>
## 1 g          5   0.385
## 2 cd         4   0.308
## 3 l          2   0.154
## 4 o          2   0.154
summarize_column(column = "LogClass_IT",
                 code = "code01")
## # A tibble: 1 x 3
##   code01     n percent
## * <chr>  <dbl>   <dbl>
## 1 s         12       1
p1 <- prep_time_series(column = "LogClass_AS_ActivityFormat",
                       code = "code01")

p1i <- p1 %>% 
  select(-file) %>% 
  rename(code_af = code)

p2 <- prep_time_series(column = "LogClass_IT",
                       code = "code01")

p2i <- p2 %>% 
  select(-file) %>% 
  rename(code_it = code)

pp <- full_join(p1i, p2i)
pp <- pp  %>%
  filter(ts > 216) %>% 
  mutate(ts = ts - 216)

pp %>% 
  ggplot(aes(x = ts, y = 1, color = code_af)) +
  geom_point() +
  geom_point(data = pp, aes(x = ts, y = 1, color = code_it), shape = 8, size = 3) +
               ylab(NULL) +
               xlab("Time (m)") +
               theme(axis.title.y = element_blank(),
                     axis.text.y = element_blank(),
                     axis.ticks.y = element_blank()) +
               scale_y_discrete(breaks = NULL) +
               labs(subtitle = stringr::str_c("Units: s")) +
               theme(text = element_text(family = "Times", size = 14)) +
               scale_x_time() +
               theme_minimal() +
               scale_color_brewer("Activity Format", type = "qual", palette = 1) +
               labs(caption = "Asterisk indicates the presence of a spin-up")

ggsave("2021-03-12-tca2-plot10.png", width = 8, height = 4)