Skip to contents

[Stable]

Run a SQL query against a dataframe.

Usage

RunQuery(strQuery, df, method = NULL)

Arguments

strQuery

character SQL query to run.

df

data.frame A data frame to use in the SQL query.

method

character A method argument to be passed to sqldf::sqldf(). Defaults to NULL.

Value

data.frame containing the results of the SQL query

Examples

df <- data.frame(
  Name = c("John", "Jane", "Bob"),
  Age = c(25, 30, 35),
  Salary = c(50000, 60000, 70000)
)
query <- "SELECT * FROM df WHERE AGE > 30"

result <- RunQuery(query, df)
#> SQL Query complete: 1 rows returned.