parse_query | R Documentation |
Parses a SQL SELECT
statement into a list with R
expressions
parse_query(query, tidyverse = FALSE, secure = TRUE)
query |
a character string containing a SQL |
tidyverse |
set to |
secure |
set to |
See the
current
limitations section of the README
for information about what types
of queries are supported.
A list object with named elements representing the clauses of the query, containing sublists of unevaluated R expressions translated from the SQL expressions in the query.
Depending on the arguments, the returned list and its sublists will have
attributes named distinct
and aggregate
with logical values
that can aid in the evaluation of the R expressions. If query
contains one or more joins, then the sublist named from
will have
attributes named join_types
and join_conditions
specifying
the types of join and the join conditions.
parse_expression
my_query <- "SELECT origin, dest, COUNT(flight) AS num_flts, round(AVG(distance)) AS dist, round(AVG(arr_delay)) AS avg_delay FROM flights WHERE distance BETWEEN 200 AND 300 AND air_time IS NOT NULL GROUP BY origin, dest HAVING num_flts > 3000 ORDER BY num_flts DESC, avg_delay DESC LIMIT 100;" parse_query(my_query) parse_query(my_query, tidyverse = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.