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

option in get_csid() to return named vector rather than list #191

Closed
Aariq opened this issue Jan 8, 2020 · 4 comments
Closed

option in get_csid() to return named vector rather than list #191

Aariq opened this issue Jan 8, 2020 · 4 comments
Milestone

Comments

@Aariq
Copy link
Collaborator

Aariq commented Jan 8, 2020

Other cs_*() functions take vectors of IDs, so the current implementation of get_csid() doesn't play nice with them when looking for results for more than one compound.

library(webchem)
apikey <- <secret>
(ids <- get_csid(c('Triclosan', "hexane"), apikey = apikey))
#> $Triclosan
#> [1] 5363
#> 
#> $hexane
#> [1] 7767
# cs_compinfo(ids, fields = c("Formula", "MolecularWeight"), apikey = apikey) #errors
cs_compinfo(c(5363, 7767), fields = c("Formula", "MolecularWeight"), apikey = apikey)
#>     id                formula molecularWeight
#> 1 5363 C_{12}H_{7}Cl_{3}O_{2}        289.5418
#> 2 7767            C_{6}H_{14}         86.1754
@Aariq Aariq added this to the v0.5.0 milestone Jan 8, 2020
@Aariq Aariq added the consistent api Uniformity across functions and data sources label Jan 8, 2020
@Aariq
Copy link
Collaborator Author

Aariq commented Jan 8, 2020

Once fixed, the example in the README should get updated too.

@Aariq Aariq assigned Aariq and unassigned Aariq Jan 8, 2020
@Aariq
Copy link
Collaborator Author

Aariq commented Jan 8, 2020

Oh, hmm.. I didn't realize compounds can have multiple csid's. Maybe an alternate solution is to have an optional first = TRUE argument that returns a vector with only one ID per query.

@Aariq Aariq removed the consistent api Uniformity across functions and data sources label Jan 8, 2020
@Aariq Aariq changed the title get_csid() should return named vector rather than list option in get_csid() to return named vector rather than list Jan 8, 2020
@Aariq
Copy link
Collaborator Author

Aariq commented Jan 24, 2020 via email

@Aariq
Copy link
Collaborator Author

Aariq commented Feb 26, 2020

I'm closing this for now because the README is fixed and we haven't settled on a consistent output for get_* functions. (see #193)

@Aariq Aariq closed this as completed Feb 26, 2020
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