Questions tagged [sqldf]

SQLDF is an R package for running SQL statements on R data frames.

SQLDF is an R package for running SQL statements on R data frames.

The user simply specifies an SQL statement in R using data frame names in place of table names and a database with appropriate table layouts/schema is automatically created, the data frames are automatically loaded into the database, the specified SQL statement is executed, the result is read back into R and the database is deleted all automatically behind the scenes.

sqldf supports:

  • the SQLite backend database (by default),
  • the H2 java database,
  • the PostgreSQL database and
  • sqldf 0.4-0 onwards also supports MySQL.

Resources:

608 questions
-2
votes
1 answer

how to create a list of data frames in R?

For each row in an input data frame I want to create a new data frame consisting of all the rows in my data with the same RETAIL_WEEK value and DAY_OF_WEEK value. For instance, if I had matchday = matchweek = 3, the following can be used to find the…
Glassjawed
  • 2,178
  • 4
  • 22
  • 36
-2
votes
2 answers

split a column into severals and covert them into one row in r

plz help me how to code to get the outcome below from the data.. i have a data frame containing more than 1000000 rows with nonconsecutive NA in it. i want to split TA_DAY column into like this: "1~5th,6~10th....continue..end" until the last row, …
Jacob Green
  • 167
  • 1
  • 1
  • 5
-3
votes
1 answer

R-language: using UDF in SQL statements

I am new to R, and I am trying to use my UDF in a SQL statement (via the sqldf function). However, I am getting an error saying no such function Does sqldf allow using UDFs? Here is a code example: mySum <- function(x,y) { ret <- x+y return(ret) }…
-3
votes
1 answer

Calculating retention rate for an application?

Trying some marketing analytics. Using R and SQL. This dataset: user_id install_date app_version 1 000a0efdaf94f2a5a09ab0d03f92f5bf 2014-12-25 v1 2 000a0efdaf94f2a5a09ab0d03f92f5bf 2014-12-25 v1 3…
J_p
  • 335
  • 1
  • 2
  • 12
-3
votes
2 answers

After spliting column values and how assign into to specific multiple column using R

dataframe in R looks like this **NAME** | MONTH jana| 19-25| jan,mar,sep,dec pugal| 45-50| april,may,june -- and i want my answer should look jana| 19-25| jan jana| 19-25| mar jana| 19-25| sep jana| 19-25| dec pugal| 45-50| …
dass
  • 39
  • 5
-3
votes
1 answer

sqldf can't read logical vectors in R

I am trying to use sqldf with a dataframe created in R. My table has 2 columns of logical vectors. My code looks like sqldf("Select* from df where Dupe1='TRUE' or Dupe2='TRUE' '' ). It returns the Error: unexpected numeric constant. Do not…
ddd
  • 1
-3
votes
2 answers

Join in R fails even though logical comparisons are true

The data is sensitive and can't be published, the answer will be in the form of guesswork, which I will be perfectly happy with. I'm trying to join a larger data.table with a smaller, and update some values. The smaller is loaded from a Excel…
ErrantBard
  • 1,200
  • 18
  • 33
-3
votes
1 answer

R: Subset a data.frame based on column of a second data.frame

Suppose there are two 2 datasets and a user wants to get all rows from first that are in second. First dataset is mtcars and second is "data" like this (for demo purposes, imagine large sets) data <-…
userJT
  • 9,328
  • 17
  • 65
  • 82
1 2 3
40
41