{"metadata":{"kernelspec":{"name":"ir","display_name":"R","language":"R"},"language_info":{"name":"R","codemirror_mode":"r","pygments_lexer":"r","mimetype":"text/x-r-source","file_extension":".r","version":"3.6.3"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"library(pacman)\n\np_load(tidyverse,fs,vroom,glue)","metadata":{"_uuid":"051d70d956493feee0c6d64651c6a088724dca2a","_execution_state":"idle","execution":{"iopub.status.busy":"2021-06-10T23:07:50.836306Z","iopub.execute_input":"2021-06-10T23:07:50.837983Z","iopub.status.idle":"2021-06-10T23:07:50.86455Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Check to see what files are available.","metadata":{}},{"cell_type":"code","source":"file_list <- dir_info(\"../input/mlb-player-digital-engagement-forecasting\") %>% \n  select(path,type,size)\n\nfile_list","metadata":{"execution":{"iopub.status.busy":"2021-06-10T22:58:16.077442Z","iopub.execute_input":"2021-06-10T22:58:16.078915Z","iopub.status.idle":"2021-06-10T22:58:16.106526Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"dir_info(\"../input/mlb-player-digital-engagement-forecasting/mlb\") %>% \n  select(path,type,size,,)\n","metadata":{"execution":{"iopub.status.busy":"2021-06-10T22:57:41.290743Z","iopub.execute_input":"2021-06-10T22:57:41.292251Z","iopub.status.idle":"2021-06-10T22:57:41.32386Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Check information on all data files.","metadata":{}},{"cell_type":"code","source":"file_path <- file_list%>%\n  filter(type==\"file\")%>%\n  pull(path)","metadata":{"execution":{"iopub.status.busy":"2021-06-10T22:59:00.864469Z","iopub.execute_input":"2021-06-10T22:59:00.866244Z","iopub.status.idle":"2021-06-10T22:59:00.891763Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"read_and_summary <- function(x){\n  read_data <- read_csv(x)\n  data_nrow <- read_data %>% nrow()\n  data_ncol <- read_data %>% ncol()\n  data_names <- read_data %>% names()\n  text <- str_split(x,\"/\")[[1]]\n\n  print(glue(\"{text[length(text)]} has {data_nrow} row {data_ncol} col\"))\n}\n\n","metadata":{"execution":{"iopub.status.busy":"2021-06-10T23:12:15.858895Z","iopub.execute_input":"2021-06-10T23:12:15.860675Z","iopub.status.idle":"2021-06-10T23:12:15.875441Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"map(.x=file_path,.f=read_and_summary)","metadata":{"execution":{"iopub.status.busy":"2021-06-10T23:12:42.574636Z","iopub.execute_input":"2021-06-10T23:12:42.576106Z","iopub.status.idle":"2021-06-10T23:14:51.935174Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Check the data header.","metadata":{}},{"cell_type":"code","source":"read_csv(file_path[1], col_types = cols()) %>% head(3)","metadata":{"execution":{"iopub.status.busy":"2021-06-10T23:22:42.806195Z","iopub.execute_input":"2021-06-10T23:22:42.807798Z","iopub.status.idle":"2021-06-10T23:22:42.869913Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"read_csv(file_path[2], col_types = cols()) %>% head(3)","metadata":{"execution":{"iopub.status.busy":"2021-06-10T23:22:48.81807Z","iopub.execute_input":"2021-06-10T23:22:48.819635Z","iopub.status.idle":"2021-06-10T23:22:48.863903Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Too heavy.\n# read_csv(file_path[3], col_types = cols()) %>% head(3)","metadata":{"execution":{"iopub.status.busy":"2021-06-10T23:24:03.945869Z","iopub.execute_input":"2021-06-10T23:24:03.952674Z","iopub.status.idle":"2021-06-10T23:24:03.978281Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"read_csv(file_path[4], col_types = cols()) %>% head(3)","metadata":{"execution":{"iopub.status.busy":"2021-06-10T23:24:06.652474Z","iopub.execute_input":"2021-06-10T23:24:06.65437Z","iopub.status.idle":"2021-06-10T23:24:06.727738Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"read_csv(file_path[5], col_types = cols()) %>% head(3)","metadata":{"execution":{"iopub.status.busy":"2021-06-10T23:24:07.639523Z","iopub.execute_input":"2021-06-10T23:24:07.641261Z","iopub.status.idle":"2021-06-10T23:24:07.68388Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"read_csv(file_path[6], col_types = cols()) %>% head(3)","metadata":{"execution":{"iopub.status.busy":"2021-06-10T23:24:08.975238Z","iopub.execute_input":"2021-06-10T23:24:08.977028Z","iopub.status.idle":"2021-06-10T23:24:09.021142Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Let the analysis begin!","metadata":{}}]}