Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upcommodity_lookup() Returning Named Vector in Specific Situations #2
Comments
|
This issue has been fixed in commit #54. Going back to the two example cases: Ex 1: commoditydf <- comtradr::ct_commodities_table(type = "HS")
input_commod <- commoditydf$commodity[c(10, 20, 30, 40)]
commodity_lookup(input_commod, commoditydf, return_code = TRUE, return_char = TRUE)now returns
Ex. 2: commoditydf <- comtradr::ct_commodities_table(type = "HS")
input_commod <- c("010119", "010231", "010594")
commodity_lookup(input_commod, commoditydf, return_code = FALSE, return_char = FALSE)now returns
|
In function
commodity_lookup(), if there is one (and only one) search result for each element of the input argvalues, the return is a named vector, regardless of whether argreturn_charisTRUEorFALSE. The intention is for the function to return an unnamed vector ifreturn_charisTRUE, and a list ifreturn_charisFALSE.Here are two reproducible examples:
Ex. 1:
returns
Ex. 2:
returns