taxon_state | R Documentation |
get_*
functionsKeep track of queries in get_*
functions
Keep track of queries in get_*
functions
This object lives inside each get_*
function call, maintaining
results as they are accumulated.
initialized
(time) time job started
finalized
(time) time job finished
class
(character) a class name (e.g., "gbif")
names
(character) one or more taxon names
count
(integer) count number of records
exit
record date/time function exited
new()
Create a new taxon_state
object
taxon_state$new(class, names)
class
(character) a class name (e.g., "gbif")
names
(character) one or more taxon names
A new taxon_state
object
print()
print method for the taxon_state
class
taxon_state$print(x, ...)
x
self
...
ignored
add()
add a record with it's result; duplicates allowed
taxon_state$add(query, result)
query
(character), a taxon name
result
(list) a named list
nothing returned; sets only
get()
get all records matching 'query'
taxon_state$get(query = NULL)
query
(character), a taxon name
a named list, with slots for the taxon id, and other attributes, named by the taxon name
remove()
remove's all records matching 'query'
taxon_state$remove(query)
query
(character), a taxon name
nothing, removes records matching query
purge()
removes all records
taxon_state$purge()
nothing returned; sets only
taxa_remaining()
get remaining taxa
taxon_state$taxa_remaining()
sorted taxon names
taxa_completed()
get completed taxa
taxon_state$taxa_completed()
sorted taxon names
clone()
The objects of this class are cloneable with this method.
taxon_state$clone(deep = FALSE)
deep
Whether to make a deep clone.
## Not run:
if (interactive()) {
ts <- taxon_state$new()
taxon_last()
ts
res <- list(
id = 123456,
att = "found",
multiple = FALSE,
direct = FALSE,
class = "tsn"
)
ts$add(query = "Quercus robur", result = res)
ts
ts$get(query = "Quercus robur")
ts$count
ts$remove(query = "Quercus robur")
ts
ts$count
res2 <- list(
id = 3430834535,
att = "found",
multiple = FALSE,
direct = FALSE,
class = "gbifid"
)
ts$add(query = "Poa annua", result = res2)
res3 <- list(
id = 1223424,
att = "found",
multiple = FALSE,
direct = FALSE,
class = "uid"
)
ts$add(query = "Puma concolor", result = res3)
ts
ts$count
ts$get("Puma concolor")
ts$get()
# cleanup
ts$purge()
ts$count
}
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.