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

request consistent var names in value from downstream(...,intermediate=TRUE) #460

Closed
philippi opened this issue Sep 24, 2015 · 5 comments
Closed
Assignees
Labels

Comments

@philippi
Copy link

A call to downstream() with intermediate=TRUE returns a list for each submitted tsn, with "target" a data.frame, and "intermediate" a list of 1 or more data.frames.
The variables in target are
tsn, parentname, parenttsn, taxonname, rankid, rankname.
The variables in an intermediate data.frame are
tsn, parentname, parenttsn, taxonname, rankId, rankName.

The last 2 variables have slightly different names.
I'm trying to expand a name/tsn to all possible downstream names that might have been used for species occurrences, which should be a mainstream usage. If the variable names were consistent, I could use rbindlist. But "rankid" v "rankId" and "rankname" v "rankName" require several more steps.

@philippi
Copy link
Author

library(taxize)
testTSN <- get_tsn("Corynorhinus",accepted=TRUE)
testdown <- downstream(testTSN,db='itis',downto='Subspecies',intermediate=TRUE)
str(testdown)

@philippi
Copy link
Author

note that this is no biggie, just a request for consistency. As far as I can tell, the last listed data.frame within each intermediate list appears to be the same as the corresponding target data.frame, so I can just discard target and parse intermediate.

eduardszoecs added a commit that referenced this issue Sep 25, 2015
eduardszoecs added a commit that referenced this issue Sep 25, 2015
@eduardszoecs
Copy link
Member

Thanks phillipi for reporting this.
Should be fixed now.

> library(taxize)
> library(taxize)
> testTSN <- get_tsn("Corynorhinus",accepted=TRUE)

Retrieving data for taxon 'Corynorhinus'

> testdown <- downstream(testTSN,db='itis',downto='Subspecies',intermediate=TRUE)
> testdown
$`555652`
$`555652`$target
     tsn               parentname parenttsn                            taxonname rankid   rankname
1 203453  Corynorhinus townsendii    203452   Corynorhinus townsendii townsendii    230 Subspecies
2 203454  Corynorhinus townsendii    203452  Corynorhinus townsendii virginianus    230 Subspecies
3 203458  Corynorhinus townsendii    203452   Corynorhinus townsendii pallescens    230 Subspecies
4 632276  Corynorhinus townsendii    203452       Corynorhinus townsendii ingens    230 Subspecies
5 632279  Corynorhinus townsendii    203452    Corynorhinus townsendii australis    230 Subspecies
6 947679 Corynorhinus rafinesquii    555664 Corynorhinus rafinesquii rafinesquii    230 Subspecies
7 948486 Corynorhinus rafinesquii    555664    Corynorhinus rafinesquii macrotis    230 Subspecies

$`555652`$intermediate
$`555652`$intermediate[[1]]
     tsn   parentname parenttsn                taxonname rankid rankname
1 203452 Corynorhinus    555652  Corynorhinus townsendii    220  Species
2 555655 Corynorhinus    555652   Corynorhinus mexicanus    220  Species
3 555664 Corynorhinus    555652 Corynorhinus rafinesquii    220  Species

$`555652`$intermediate[[2]]
     tsn               parentname parenttsn                            taxonname rankid   rankname
1 203453  Corynorhinus townsendii    203452   Corynorhinus townsendii townsendii    230 Subspecies
2 203454  Corynorhinus townsendii    203452  Corynorhinus townsendii virginianus    230 Subspecies
3 203458  Corynorhinus townsendii    203452   Corynorhinus townsendii pallescens    230 Subspecies
4 632276  Corynorhinus townsendii    203452       Corynorhinus townsendii ingens    230 Subspecies
5 632279  Corynorhinus townsendii    203452    Corynorhinus townsendii australis    230 Subspecies
6 947679 Corynorhinus rafinesquii    555664 Corynorhinus rafinesquii rafinesquii    230 Subspecies
7 948486 Corynorhinus rafinesquii    555664    Corynorhinus rafinesquii macrotis    230 Subspecies



attr(,"class")
[1] "downstream"
attr(,"db")
[1] "itis"

@sckott Shouldn't we make all thorughout taxize lowercase? Then we don't have to care...
I am not a fan of camelCase. This means a lot of changes and may be a midterm goal?
What do you think is it worth the time? It will be only an internal change and not user visible...

@eduardszoecs
Copy link
Member

Closing this and opened a new issue #462 .

eduardszoecs added a commit that referenced this issue Sep 25, 2015
fixed bug introduced by last commit, see issue #460
@sckott
Copy link
Contributor

sckott commented Sep 26, 2015

Sorry. On vacation now. Back to computer in a few days

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

No branches or pull requests

3 participants