make.R

library(drake)
library(tidyverse); library(tidygraph)
library(igraph)
#library(TermPaper)
library(usethis); library(devtools); library(testthat)
rm(list = ls())

pkgconfig::set_config("drake::strings_in_dots" = "literals")

plan <- drake::drake_plan(

  # load list of data frames
  df.list = loaddata(),

  # prepare exhibition df
  exhibitions = tidy_exhibitions(df.list),

  # prepare df containing the exhibition places
  exhplaces = tidy_exhplaces(df.list, exhibitions),

  # prepare df containing the artists
  artists = tidy_artists(df.list),

  # create edge list
  edges_alive = create_edgelist(exhibitions,
                                artists,
                                exhplaces,
                                .venue_max_years_between_exhibitions = 25,
                                .venue_remove_only_self_referential = T,
                                .venue_min_num_of_exh = 2,
                                .artist_remove_exhibition_after_death = T),

  # create complete graph from all exhibitions available
  galsimple = construct_career_path_network(edges_alive, exhplaces,
                                            .remove_loops = T, .remove_isolates = T),

  # create df of artists with several restricions for data quality
  # artists_lean = create_artist_selection(galsimple, artists,
  #                                        .max_years_between_birth_first_exh = 50,
  #                                        .count_only_exh_alive = T,
  #                                        .period_start = 1975, .period_end = 2015,
  #                                        .num_exh_in_period = 10),

  galsimple_eigen  = compute_eigen_centr_period(galsimple, .year_start = 1975, .year_end = 2017, .only_active_places = T,
                                                .set_centrality_NA_if_inactive = T, .lower_boundary_year = 1965,
                                                .only_n_past_exh = NULL),

  galsimple_eigen_past5 = compute_eigen_centr_period(galsimple, .year_start = 1975, .year_end = 2017, .only_active_places = T,
                                                     .set_centrality_NA_if_inactive = T, .lower_boundary_year = 1965,
                                                     .only_n_past_exh = 5, .output_as_nodes_df_long = T),

  galsimple_eigen_past10 = compute_eigen_centr_period(galsimple, .year_start = 1975, .year_end = 2017, .only_active_places = T,
                                                      .set_centrality_NA_if_inactive = T, .lower_boundary_year = 1965,
                                                      .only_n_past_exh = 10, .output_as_nodes_df_long = T),

  galsimple_eigen_past25 = compute_eigen_centr_period(galsimple, .year_start = 1975, .year_end = 2017,.only_active_places = T,
                                                      .set_centrality_NA_if_inactive = T,.lower_boundary_year = 1965,
                                                      .only_n_past_exh = 25, .output_as_nodes_df_long = T),

  galsimple_eigen_past50 = compute_eigen_centr_period(galsimple, .year_start = 1975, .year_end = 2017, .only_active_places = T,
                                                      .set_centrality_NA_if_inactive = T, .lower_boundary_year = 1965,
                                                      .only_n_past_exh = 50, .output_as_nodes_df_long = T),

  galsimple_eigen_past75  = compute_eigen_centr_period(galsimple, .year_start = 1975, .year_end = 2017, .only_active_places = T,
                                                       .set_centrality_NA_if_inactive = T, .lower_boundary_year = 1965,
                                                       .only_n_past_exh = 75, .output_as_nodes_df_long = T),

  galsimple_eigen_past100  = compute_eigen_centr_period(galsimple, .year_start = 1975, .year_end = 2017, .only_active_places = T,
                                                       .set_centrality_NA_if_inactive = T, .lower_boundary_year = 1965,
                                                       .only_n_past_exh = 100, .output_as_nodes_df_long = T)

  # EDGES ORDER INF
  # edges_alive_tinf = create_edgelist(exhibitions,
  #                                    artists,
  #                                    exhplaces,
  #                                    .venue_max_years_between_exhibitions = 50,
  #                                    .venue_remove_only_self_referential = T,
  #                                    .venue_min_num_of_exh = 5,
  #                                    .order_1_network = F,
  #                                    .artist_remove_exhibition_after_death = T),
  #
  # # create complete graph from all exhibitions available
  # galsimple_inf = construct_career_path_network(edges_alive_tinf, exhplaces,
  #                                               .remove_loops = T, .remove_isolates = T),
  #
  # galsimple_inf_eigen1975_2015_base1965  = compute_eigen_centr_period(galsimple_inf, .year_start = 1975, .year_end = 2017, .only_active_places = T,
  #                                                                     .set_centrality_NA_if_inactive = T,
  #                                                                     .lower_boundary_year = 1965, .only_n_past_exh = NULL),
  #
  # galsimple_inf_eigen1975_2015_base1945  = compute_eigen_centr_period(galsimple_inf, .year_start = 1975, .year_end = 2017, .only_active_places = T,
  #                                                                     .set_centrality_NA_if_inactive = T,
  #                                                                     .lower_boundary_year = 1945, .only_n_past_exh = NULL),
  #
  # galsimple_eigen_inf_past5 = compute_eigen_centr_period(galsimple_inf, .year_start = 1975, .year_end = 2017, .only_active_places = T,
  #                                                        .set_centrality_NA_if_inactive = T, .lower_boundary_year = 1965,
  #                                                        .only_n_past_exh = 5, .output_as_nodes_df_long = T),
  #
  # galsimple_eigen_inf_past10 = compute_eigen_centr_period(galsimple_inf, .year_start = 1975, .year_end = 2017, .only_active_places = T,
  #                                                         .set_centrality_NA_if_inactive = T, .lower_boundary_year = 1965,
  #                                                         .only_n_past_exh = 10, .output_as_nodes_df_long = T),
  #
  # galsimple_eigen_inf_past25 = compute_eigen_centr_period(galsimple_inf, .year_start = 1975, .year_end = 2017,.only_active_places = T,
  #                                                         .set_centrality_NA_if_inactive = T,.lower_boundary_year = 1965,
  #                                                         .only_n_past_exh = 25, .output_as_nodes_df_long = T),
  #
  # galsimple_eigen_inf_past50 = compute_eigen_centr_period(galsimple_inf, .year_start = 1975, .year_end = 2017, .only_active_places = T,
  #                                                         .set_centrality_NA_if_inactive = T, .lower_boundary_year = 1965,
  #                                                         .only_n_past_exh = 50, .output_as_nodes_df_long = T),
  #
  # galsimple_eigen_inf_past75  = compute_eigen_centr_period(galsimple_inf, .year_start = 1975, .year_end = 2017, .only_active_places = T,
  #                                                          .set_centrality_NA_if_inactive = T, .lower_boundary_year = 1965,
  #                                                          .only_n_past_exh = 75, .output_as_nodes_df_long = T),
  #
  # galsimple_eigen_inf_past100  = compute_eigen_centr_period(galsimple_inf, .year_start = 1975, .year_end = 2017, .only_active_places = T,
  #                                                           .set_centrality_NA_if_inactive = T, .lower_boundary_year = 1965,
  #                                                           .only_n_past_exh = 100, .output_as_nodes_df_long = T)


  # report = rmarkdown::render(
  #   input = file_in('written/Broska_BA.Rmd'),
  #   output_dir = 'written',
  #   output_file = file_out('Broska_BA.pdf'),
  #   encoding = 'UTF-8'
  # )

)


devtools::load_all()
drake::make(plan )

# visualize depency graph
#vis_drake_graph(drake_config(plan))

# load objects to working directory
drake::loadd()
Framus94/HierarchiesAndCareers documentation built on June 5, 2019, 8:52 a.m.