MatthewSmith430 / CompaniesHouse

This package allows to extract data from the Companies House API and create interlocking directorates networks
31 stars 5 forks source link

CompanySIC not working with some company IDs #6

Closed 1lliter8 closed 4 years ago

1lliter8 commented 4 years ago

For most companies CompanySIC safely returns a vector containing a single company ID. However some, like '02858176', have nested data frames in their JSON object that flatten = TRUE doesn't handle. In this case, it's a nested data frame of previous company names under JLfirm$previous_company_names. The result is an error when trying to run data.frame(JLfirm).

Error in (function (..., row.names = NULL, check.rows = FALSE, check.names = TRUE,  : 
  arguments imply differing number of rows: 1, 3, 2

Because we only need the SIC codes and they're already present in the JSON object, I'm going to update the function to return the SIC codes from there rather than converting to a data frame.