Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

commodity_lookup() throwing error, related to param return_char #3

Closed
ChrisMuir opened this issue Aug 7, 2017 · 1 comment
Closed

Comments

@ChrisMuir
Copy link
Member

When a single lookup value is passed, the functions works great:

commodity_lookup("trout", commoditydf, return_char = FALSE)

However when multiple lookup values are passed, AND return_char is set to FALSE, the function throws an error:

commodity_lookup(c("tomato", "trout"), commoditydf, return_char = FALSE)

results in:

Error in function_list[[k]](value) : 
  'names' attribute [2] must be the same length as the vector [1]

The desired output is a named list of length two.

I'm working on patching this bug now.

@ChrisMuir
Copy link
Member Author

This issue has been fixed in commit #56

Returning to the example from above:

commodity_lookup(c("tomato", "trout"), commoditydf, return_char = FALSE)

now returns:

$tomato
[1] "0702 - Tomatoes; fresh or chilled"                                                                                                         
[2] "070200 - Vegetables; tomatoes, fresh or chilled"                                                                                           
[3] "2002 - Tomatoes; prepared or preserved otherwise than by vinegar or acetic acid"                                                           
[4] "200210 - Vegetable preparations; tomatoes, whole or in pieces, prepared or preserved otherwise than by vinegar or acetic acid"             
[5] "200290 - Vegetable preparations; tomatoes, (other than whole or in pieces), prepared or preserved otherwise than by vinegar or acetic acid"
[6] "200950 - Juice; tomato, unfermented, not containing added spirit, whether or not containing added sugar or other sweetening matter"        
[7] "210320 - Sauces; tomato ketchup and other tomato sauces"                                                                                   

$trout
[1] "030191 - Fish; live, trout (salmo trutta, salmo gairdneri, salmo clarki, salmo aguabonita, salmo gilae)"                                                                                                                                                            
[2] "030211 - Fish; trout (salmo trutta, salmo gairdneri, salmo clarki, salmo aguabonita, salmo gilae), fresh or chilled (excluding fillets, livers, roes and other fish meat of heading no. 0304)"                                                                      
[3] "030314 - Fish; frozen, trout (Salmo trutta, Oncorhynchus mykiss, Oncorhynchus clarki, Oncorhynchus aguabonita, Oncorhynchus gilae, Oncorhynchus apache and Oncorhynchus chrysogaster), excluding fillets, meat of 0304, and edible fish offal of 0303.91 to 0303.99"
[4] "030321 - Fish; trout (salmo trutta, salmo gairdneri, salmo clarki, salmo aguabonita, salmo gilae), frozen (excluding fillets, livers, roes and other fish meat of heading no. 0304)"                                                                                
[5] "030442 - Fish fillets; fresh or chilled, trout (Salmo trutta, Oncorhynchus mykiss, Oncorhynchus clarki, Oncorhynchus aguabonita, Oncorhynchus gilae, Oncorhynchus apache and Oncorhynchus chrysogaster)"                                                            
[6] "030482 - Fish fillets; frozen, trout (Salmo trutta, Oncorhynchus mykiss, Oncorhynchus clarki, Oncorhynchus aguabonita, Oncorhynchus gilae, Oncorhynchus apache and Oncorhynchus chrysogaster)"                                                                      
[7] "030543 - Fish; smoked, whether or not cooked before or during smoking, trout (Salmo trutta, Oncorhynchus mykiss/clarki/aguabonita/gilae/apache/chrysogaster), includes fillets, but excludes edible fish offal"   

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant