Title: | Prepare Data for PACTA for Investors |
---|---|
Description: | This package provides tools to prepare input datasets to be run in the PACTA_analysis tool. |
Authors: | CJ Yetman [aut, cre, ctr] , Jackson Hoffart [aut, ctr] , Jacob Kastl [aut, ctr], Alex Axthelm [aut, ctr] , RMI [cph, fnd] |
Maintainer: | CJ Yetman <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.0.9003 |
Built: | 2024-10-30 12:23:50 UTC |
Source: | https://github.com/rmi-pacta/pacta.data.preparation |
[equity/bonds]_abcd_scenario.rds
format that is used by portfolio.analysisCombine ABCD and scenario data into the [equity/bonds]_abcd_scenario.rds
format that is used by portfolio.analysis
dataprep_abcd_scen_connection( abcd_data, scenario_data, reference_year, relevant_years, tech_exclude, scenario_geographies_list, sector_list, other_sector_list, global_aggregate_scenario_sources_list, global_aggregate_sector_list, scenario_regions, index_regions )
dataprep_abcd_scen_connection( abcd_data, scenario_data, reference_year, relevant_years, tech_exclude, scenario_geographies_list, sector_list, other_sector_list, global_aggregate_scenario_sources_list, global_aggregate_sector_list, scenario_regions, index_regions )
abcd_data |
A tibble containing the ABCD data |
scenario_data |
A tibble containing the scenario data |
reference_year |
A single numeric specifying the market share target reference year |
relevant_years |
A numeric vector containing all relevant years to be calculated |
tech_exclude |
A character vector containing the technologies to be excluded |
scenario_geographies_list |
A character vector containing the scenario geographies to be used |
sector_list |
A character vector containing the sectors to be included |
other_sector_list |
A character vector containing the sectors considered "other" |
global_aggregate_scenario_sources_list |
A character vector containing the scenario sources to be included in the global aggreagte |
global_aggregate_sector_list |
A character vector containing the sectors to be included in the global aggregate |
scenario_regions |
A character vector containing the scenario regions |
index_regions |
A character vector containing the index regions |
A tibble with the combined ABCD and scenario data
Determine relevant years
determine_relevant_years(market_share_target_reference_year, time_horizon)
determine_relevant_years(market_share_target_reference_year, time_horizon)
market_share_target_reference_year |
A single numeric value determining the Market Share target reference year |
time_horizon |
A single numeric value determining the number of forward looking years |
A numeric vector containg all of the relevant years
Import the data from a version of Asset Resolution's proprietary Advanced Company Indicators XLSX into a tidy data frame.
import_ar_advanced_company_indicators( filepath, drop_nas = TRUE, fix_names = FALSE, as_factor = TRUE )
import_ar_advanced_company_indicators( filepath, drop_nas = TRUE, fix_names = FALSE, as_factor = TRUE )
filepath |
Path to the XLSX file. |
drop_nas |
A logical indicating whether rows with an |
fix_names |
A logical indicating whether the column names should be
fixed to snakecase format. (e.g. |
as_factor |
A logical indicating whether the character columns should be
converted to factors(default is |
A tibble including all the data from the "Company Information", "Company ISINs", "Company Emissions", and "Company Activities" tabs combined into one tidy tibble.
masterdata_*.csv
files into a tidy data frame.Import the data from a version of Asset Resolution's bespoke
masterdata_*.csv
files into a tidy data frame.
import_ar_masterdata(filepath, drop_nas = TRUE, id_as_string = FALSE)
import_ar_masterdata(filepath, drop_nas = TRUE, id_as_string = FALSE)
filepath |
Path to the CSV file. |
drop_nas |
A logical indicating whether rows with an |
id_as_string |
A logical indicating whether the |
A tidy, long-format tibble of all the data in the masterdata_*.csv
file with an added consolidation_method
column to record which of
"ownership" or "debt" file was imported.
Title
prepare_abcd_flags_bonds( financial_data, factset_entity_id__ar_company_id, factset_entity_id__security_mapped_sector, ar_company_id__sectors_with_assets__debt, factset_entity_id__credit_parent_id )
prepare_abcd_flags_bonds( financial_data, factset_entity_id__ar_company_id, factset_entity_id__security_mapped_sector, ar_company_id__sectors_with_assets__debt, factset_entity_id__credit_parent_id )
financial_data |
A data frame containing financial data |
factset_entity_id__ar_company_id |
A data frame containing a factset_entity_id to ar_company_id look up table |
factset_entity_id__security_mapped_sector |
A data frame containing a factset_entity_id to security_mapped_sector look up table |
ar_company_id__sectors_with_assets__debt |
A data frame containing a ar_company_id to sectors_with_assets look up table for debt |
factset_entity_id__credit_parent_id |
A data frame containing a factset_entity_id to credit_parent_id look up table |
A data frame
Title
prepare_abcd_flags_equity( financial_data, factset_entity_id__ar_company_id, factset_entity_id__security_mapped_sector, ar_company_id__sectors_with_assets__ownership )
prepare_abcd_flags_equity( financial_data, factset_entity_id__ar_company_id, factset_entity_id__security_mapped_sector, ar_company_id__sectors_with_assets__ownership )
financial_data |
A data frame containing financial data |
factset_entity_id__ar_company_id |
A data frame containing a factset_entity_id to ar_company_id look up table |
factset_entity_id__security_mapped_sector |
A data frame containing a factset_entity_id to security_mapped_sector look up table |
ar_company_id__sectors_with_assets__ownership |
A data frame containing a ar_company_id to sectors_with_assets look up table for ownership |
A data frame
ar_company_id__country_of_domicile
lookup table from the
entity_info
dataPrepare an ar_company_id__country_of_domicile
lookup table from the
entity_info
data
prepare_ar_company_id__country_of_domicile(entity_info)
prepare_ar_company_id__country_of_domicile(entity_info)
entity_info |
A data frame containing the entity info |
A tibble
ar_company_id__credit_parent_ar_company_id
lookup table from the
entity_info
dataPrepare an ar_company_id__credit_parent_ar_company_id
lookup table from the
entity_info
data
prepare_ar_company_id__credit_parent_ar_company_id(entity_info)
prepare_ar_company_id__credit_parent_ar_company_id(entity_info)
entity_info |
A data frame containing the entity info |
A tibble
ar_company_id__sectors_with_assets__debt
lookup table from the
masterdata_debt_datastore
dataPrepare an ar_company_id__sectors_with_assets__debt
lookup table from the
masterdata_debt_datastore
data
prepare_ar_company_id__sectors_with_assets__debt( masterdata_debt_datastore, relevant_years )
prepare_ar_company_id__sectors_with_assets__debt( masterdata_debt_datastore, relevant_years )
masterdata_debt_datastore |
A data frame containing processed production data from Asset Impact's masterdata_ownership CSV |
relevant_years |
A numeric vector containing the relevant years of data to include |
A tibble
ar_company_id__sectors_with_assets__ownership
lookup table from
the masterdata_ownership_datastore
dataPrepare an ar_company_id__sectors_with_assets__ownership
lookup table from
the masterdata_ownership_datastore
data
prepare_ar_company_id__sectors_with_assets__ownership( masterdata_ownership_datastore, relevant_years )
prepare_ar_company_id__sectors_with_assets__ownership( masterdata_ownership_datastore, relevant_years )
masterdata_ownership_datastore |
A data frame containing processed production data from Asset Impact's masterdata_ownership CSV |
relevant_years |
A numeric vector containing the relevant years of data to include |
A tibble
company_id__creditor_company_id
lookup table from Asset Impact's
masterdata_debt
dataPrepare a company_id__creditor_company_id
lookup table from Asset Impact's
masterdata_debt
data
prepare_company_id__creditor_company_id(masterdata_debt)
prepare_company_id__creditor_company_id(masterdata_debt)
masterdata_debt |
A data frame containing raw production data from Asset Impact's masterdata_debt CSV |
A tibble
entity_info
output data frame from data frames imported from
the factset_entity_info.rds
and ar_company_id__factset_entity_id.rds
filesPrepare the entity_info
output data frame from data frames imported from
the factset_entity_info.rds
and ar_company_id__factset_entity_id.rds
files
prepare_entity_info( data, factset_entity_id__ar_company_id, factset_industry_map_bridge, factset_manual_pacta_sector_override )
prepare_entity_info( data, factset_entity_id__ar_company_id, factset_industry_map_bridge, factset_manual_pacta_sector_override )
data |
A data frame containing the imported |
factset_entity_id__ar_company_id |
A data frame containing the imported
|
factset_industry_map_bridge |
A data frame containing the imported
|
factset_manual_pacta_sector_override |
A data frame containing the imported
|
A tibble properly prepared to be saved as the entity_info.rds
output file
factset_entity_id__ar_company_id
lookup table from Asset Impact's
ar_company_id__factset_entity_id
crosswalkPrepare a factset_entity_id__ar_company_id
lookup table from Asset Impact's
ar_company_id__factset_entity_id
crosswalk
prepare_factset_entity_id__ar_company_id(ar_company_id__factset_entity_id)
prepare_factset_entity_id__ar_company_id(ar_company_id__factset_entity_id)
ar_company_id__factset_entity_id |
A data frame containing a production data company ID to financial data entity lookup table |
A tibble
factset_entity_id__credit_parent_id
lookup table from
entity_info
Prepare a factset_entity_id__credit_parent_id
lookup table from
entity_info
prepare_factset_entity_id__credit_parent_id(entity_info)
prepare_factset_entity_id__credit_parent_id(entity_info)
entity_info |
A data frame containing the entity info |
A tibble
factset_entity_id__security_mapped_sector
lookup table from
entity_info
Prepare a factset_entity_id__security_mapped_sector
lookup table from
entity_info
prepare_factset_entity_id__security_mapped_sector(entity_info)
prepare_factset_entity_id__security_mapped_sector(entity_info)
entity_info |
A data frame containing the entity info |
A tibble
financial_data
output data frame from the imported
factset_financial_data.rds
filePrepare the financial_data
output data frame from the imported
factset_financial_data.rds
file
prepare_financial_data(data, issue_code_bridge)
prepare_financial_data(data, issue_code_bridge)
data |
A data frame containing the imported |
issue_code_bridge |
A data frame containing data that bridges from
factset issue codes to one of |
A tibble properly prepared to be saved as the financial_data.rds
output file
MISSINGWEIGHT
holding for the differencePrepare fund data, filtering to funds with data according to a given
threshold and adding a MISSINGWEIGHT
holding for the difference
prepare_fund_data(fund_data, threshold = 0)
prepare_fund_data(fund_data, threshold = 0)
fund_data |
A data frame containing fund data |
threshold |
A numeric value between 0 and 1 (inclusive) indicating the allowable percentage of the total fund value that the summed values of its component holdings should be equal to or greater than |
A tibble
isin_to_fund_table
, filtering out fsyms that have more than 1 row
and either no fund data or fund data for both rowsPrepare isin_to_fund_table
, filtering out fsyms that have more than 1 row
and either no fund data or fund data for both rows
prepare_isin_to_fund_table(isin_to_fund_table, fund_data)
prepare_isin_to_fund_table(isin_to_fund_table, fund_data)
isin_to_fund_table |
A data frame containing isin_to_fund_table data |
fund_data |
A data frame containing fund data |
A tibble
iss_average_sector_emission_intensities
objectPrepare a iss_average_sector_emission_intensities
object
prepare_iss_average_sector_emission_intensities( iss_company_emissions, factset_financial_data, factset_entity_info, factset_entity_financing_data, currencies )
prepare_iss_average_sector_emission_intensities( iss_company_emissions, factset_financial_data, factset_entity_info, factset_entity_financing_data, currencies )
iss_company_emissions |
A data frame containing |
factset_financial_data |
A data frame containing
|
factset_entity_info |
A data frame containing |
factset_entity_financing_data |
A data frame containing
|
currencies |
A data frame containing currency exchange rate data |
A data frame containing the prepared
iss_average_sector_emission_intensities
object
iss_company_emissions
object from factset_iss_emissions_data
Prepare an iss_company_emissions
object from factset_iss_emissions_data
prepare_iss_company_emissions(factset_iss_emissions_data)
prepare_iss_company_emissions(factset_iss_emissions_data)
factset_iss_emissions_data |
A data frame containing ISS emissions data |
A tibble
iss_entity_emission_intensities
objectPrepare a iss_entity_emission_intensities
object
prepare_iss_entity_emission_intensities( iss_company_emissions, factset_financial_data, factset_entity_info, factset_entity_financing_data, currencies )
prepare_iss_entity_emission_intensities( iss_company_emissions, factset_financial_data, factset_entity_info, factset_entity_financing_data, currencies )
iss_company_emissions |
A data frame containing |
factset_financial_data |
A data frame containing
|
factset_entity_info |
A data frame containing |
factset_entity_financing_data |
A data frame containing
|
currencies |
A data frame containing currency exchange rate data |
A data frame containing the prepared
iss_entity_emission_intensities
object
masterdata_ownership_datastore
or masterdata_debt_datastore
output data frame from an import of a raw AR masterdata_* CSVPrepare the masterdata_ownership_datastore
or masterdata_debt_datastore
output data frame from an import of a raw AR masterdata_* CSV
prepare_masterdata( data, ar_company_id__country_of_domicile, pacta_financial_timestamp, zero_emission_factor_techs )
prepare_masterdata( data, ar_company_id__country_of_domicile, pacta_financial_timestamp, zero_emission_factor_techs )
data |
A dataframe containing the raw input of an AR masterdata_* CSV files |
ar_company_id__country_of_domicile |
A data frame with two columns
mapping |
pacta_financial_timestamp |
A single element character vector specifying the timestamp in the PACTA format, e.g. "2021Q4" |
zero_emission_factor_techs |
A character vector listing technologies that will have emission factors manually forced to 0 |
A tibble properly prepared to be saved as the
masterdata_ownership_datastore.rds
or masterdata_debt_datastore.rds
output file
masterdata_debt_datastore
object from a raw masterdata_debt CSVPrepare the masterdata_debt_datastore
object from a raw masterdata_debt CSV
prepare_masterdata_debt( masterdata_debt_raw, ar_company_id__country_of_domicile, ar_company_id__credit_parent_ar_company_id, pacta_financial_timestamp, zero_emission_factor_techs )
prepare_masterdata_debt( masterdata_debt_raw, ar_company_id__country_of_domicile, ar_company_id__credit_parent_ar_company_id, pacta_financial_timestamp, zero_emission_factor_techs )
masterdata_debt_raw |
A data frame containing the raw data from a masterdata_debt CSV |
ar_company_id__country_of_domicile |
A data frame containing an
|
ar_company_id__credit_parent_ar_company_id |
A data frame containing an
|
pacta_financial_timestamp |
A single character vector containing the
PACTA financial timestamp, e.g. |
zero_emission_factor_techs |
A character vector containing the zero emission factor technologies |
A data frame containing the prepared masterdata_debt_datastore
total_fund_list
object from fund_data
Prepare a total_fund_list
object from fund_data
prepare_total_fund_list(fund_data)
prepare_total_fund_list(fund_data)
fund_data |
A data frame containing fund data |
A tibble
Convert a PACTA style quarter string to a FactSet style date string for the last day of that quarter
quarter_to_factset_timestamp(quarter)
quarter_to_factset_timestamp(quarter)
quarter |
A character vector containing PACTA style quarter strings in the form e.g. "2021Q4" |
A character vector containing the equivalent FactSet style date strings for the last day of the quarter e.g. "2021-12-31"
Convert a PACTA style quarter string to an IMF style quarter string
quarter_to_imf_timestamp(quarter)
quarter_to_imf_timestamp(quarter)
quarter |
A character vector containing PACTA style quarter strings in the form e.g. "2021Q4"X |
A character vector containing the equivalent IMF style quarter strings e.g. "2021-Q4"
Standardize asset type names
standardize_asset_type_names(factset_issue_code_bridge)
standardize_asset_type_names(factset_issue_code_bridge)
factset_issue_code_bridge |
A data frame containing the FactSet issue code bridge |
A data frame containing a FactSet issue_type_code
to asset_type
lookup
Write a manifest.json file to the specified path including critical information about the files and parameters used to prepare the data
write_manifest(path, parameters, input_files, output_files)
write_manifest(path, parameters, input_files, output_files)
path |
A single string specifying a filepath to save the JSON file to |
parameters |
A list containing all parameters used to create the data |
input_files |
A vector with filepaths of input files used to create the output data. |
output_files |
A vector with filepaths of output files created. |
Called for the side-effect of writing a JSON file to disk