Learn R Programming

qmj (version 0.2.1)

get_companies: Builds a companies data frame from a text file.

Description

get_companies reads in the contents of a text file created from the pdf of company names and tickers given by the Russell 3000 Index.

Usage

get_companies(filepath = system.file("extdata/companies.txt", package = "qmj"))

Value

data.frame of companies info

Arguments

filepath

Specifies the filepath of the text file containing the company names and tickers of interest. May be either absolute or relative to working directory.

Functions

  • get_companies(): function splits by space and grabs everything before the last word as the name and has the last word as the ticker. Which chunk it returns is determined by the is_name variable.

Details

The user must copy and paste the contents of the Russell 3000 Index into a text file for this function to process the data correctly. Simply select all of the component list and paste the contents into an empty document with the .txt extension. The list may be found here.

If you wish to use your own text file of companies for get_companies to process, create a text file containing each company on a separate line. Every word and ticker must be capitalized, and the ticker must be the last word, separated by a space, on each line.

get_companies by default uses a text file created from the Russell 3000 Index in the package.

Examples

Run this code
get_companies()

Run the code above in your browser using DataLab