50% off | Unlimited Data & AI Learning
Get 50% off unlimited learning

edgar (version 1.0.9)

mergeCompustat: Connect sentiment count of multiple cik's 10-K filing with Compustat data.

Description

mergeCompustat merge sentiment count of 10-K filing with Compustat data.

Usage

mergeCompustat (cik.no, filing.yr, words.list, compustat.data)

Arguments

cik.no

cik number.

filing.yr

10-K filing year.

words.list

sentiment dictionary in list format.

compustat.data

Compustat dataframe.

Value

Compustat data with sentiment.count column for desired cik and filing year.

Details

mergeCompustat function takes cik number, filing year, sentiment dictionary, and Compustat data. It downloads 10-K filings for desired cik and filing year present in an input Compustat dataset in new directory "Edgar filings/Compustat filings". The function also counts sentiment words from 10-K's and append those counts with new column named "sentiment.count" to Compustat dataframe. Working directory must contain 'Master Index' directory which contains master Rda files for specified filing year. This master index can be downloaded using getMasterIndex function. Please note that Compustat data must contains 'cik' column, and 'datadate' column in 'mm/dd/yyyy' format.

Examples

Run this code
# NOT RUN {
## User needs to input Compustat data in dataframe format.
compustat.data <- read.csv('compustat_data.csv')

## User can apply any desired user defined dictionary 
## other than default dictionaries from this package.
words.list <- scan(system.file('data/negwords.txt', package = 'edgar') 
                   , what='character')

## For single cik
res <- mergeCompustat( 2098, 2014, words.list, compustat.data)

## User can provide list of different CIK's.
cik.no <- c(1750,6201,2098)
res <- mergeCompustat( cik.no, 2014, words.list, compustat.data)
 
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab