-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.R
69 lines (53 loc) · 2.72 KB
/
start.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -#
# #
# Chapter 1 - Measuring Firms Investment Plans: A text-based analysis #
# #
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -#
## Working directory -----------------------------------------------------------
## Check if the current working directory is the project folder
getwd()
## If not, set the right working directory, which your project folder is located
# setwd("C:/") ## <--- Change here, make sure to avoid using single backslashes (i.e. \)
## Language --------------------------------------------------------------------
# Set language in English to resolve issues based on error messages
Sys.setenv(LANG = "en")
## Set up pipeline folder if missing ------------------------------------------
## The code below will automatically create a pipeline folder for this code file
## if it does not exist.
if (!(dir.exists(file.path(getwd(), "2_pipeline")))) {
dir.create(file.path(getwd(), "2_pipeline"))
}
## Imports ---------------------------------------------------------------------
library(RPostgres)
library(reticulate)
library(lubridate)
library(data.table)
library(tidyverse)
# ## Install packages by using groundhog to address reproducible research
# ## Se more in http://datacolada.org/95 or https://groundhogr.com/
#
# ## All the library imports go here
# pkgs = c('lubridate','data.table', 'dplyr')
#
# library(groundhog)
# groundhog_day = "2020-12-31" # Last date when script runs as expected
# groundhog.library(pkgs, groundhog_day)
# Set sample date range --------------------------------------------------------
begdate = '01/01/1966'
enddate = '12/31/2019'
## Functions -------------------------------------------------------------------
source('1_code/functions.R')
## Source next steps -----------------------------------------------------------
## If you prefer, you can source each script by this one
# ## Load Data From server (Run once)
# source("Data/getWRDSdata.R", echo = T)
source("1_code/1a_organizeCRSPComp.R", echo = T)
source("1_code/1b_organizeCCM.R", echo = T)
source("1_code/2a_lifeCycleProxies.R", echo = T)
source("1_code/3a_linkDataSEC_CCM.R", echo = T)
source("1_code/4a_eigBenchMark.R", echo = T)
source("1_code/5a_eigTextBased_terms_CS.R", echo = T)
source("1_code/5b_eigTextBased_terms_Indst.R", echo = T)
source("1_code/5c_eigTextBased_terms_LCycle.R", echo = T)
source("1_code/6a_eigTextBased_bestWords.R", echo = T)
source("1_code/functions.R", echo = T)