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.
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 thatflatten = TRUE
doesn't handle. In this case, it's a nested data frame of previous company names underJLfirm$previous_company_names
. The result is an error when trying to rundata.frame(JLfirm)
.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.