Learn R Programming

shroomDK (version 0.3.0)

clean_query: Clean Query

Description

Converts query response to data frame while attempting to coerce classes intelligently.

Usage

clean_query(request, try_simplify = TRUE)

Value

A data frame. If `try_simplify` is FALSE OR if `try_simplify` TRUE fails: the data frame is comprised of lists, where each column must be coerced to a desired class (e.g., with `as.numeric()`).

Arguments

request

The request output from get_query_from_token()

try_simplify

because requests can return JSON and may not have the same length across values, they may not be data frame compliant (all columns having the same number of rows). A key example would be TX_JSON in EVM FACT_TRANSACTION tables which include 50+ extra details from transaction logs. But other examples like NULLs in TO_ADDRESS can have similar issues. Default TRUE.

Examples

Run this code
if (FALSE) {
query <- create_query_token("SELECT * FROM ETHEREUM.CORE.FACT_TRANSACTIONS LIMIT 1000", api_key)
request <- get_query_from_token(query$result$queryRequest$queryRunId, api_key)
df1 <- clean_query(request, try_simplify = TRUE)
}

Run the code above in your browser using DataLab