-6

Please run the code below: The "patients$time" column gives the timestamp. I want to fetch all the records between two times say first row value "2017-01-02 11:41:53" and 226th row value "2017-08-07 09:06:07". I want to basically get all the records between these two times. I tried dbGetquery but am getting an error. Please help.

library(bupaR)
patients

enter image description here

Ashmin Kaul
  • 860
  • 2
  • 12
  • 37

1 Answers1

1

Try this:

patients[patients$time > '2017-01-02 11:41:53' & patients$time < '2017-08-07 09:06:07',]
Hardik Gupta
  • 4,700
  • 9
  • 41
  • 83
  • the solution is very helpful thanks, but suppose I am fetching data from a database where billions of records are present, I wanted a functionality in R and sql such that I fetch the subset of the data only to make the solution faster. Please help. – Ashmin Kaul Dec 15 '17 at 09:12
  • your question is incorrect, you present a dataframe and expect to give a dbquery answer? – Hardik Gupta Dec 15 '17 at 09:13
  • the question is correct, still I find your solution helpful, thanks. – Ashmin Kaul Dec 15 '17 at 09:15