Error in RSQLite() : could not find function "RSQLite"

I am just starting the guided project for the SQL section and I copied the correct answer just to get the data base loaded in R and it doesn’t know the function above:

Here’s what the solution says to do in RStudio:

library(RSQLite)
library(DBI)

conn = dbConnect(RSQLite(), “./factbook.db”)
q1 = “SELECT * FROM facts LIMIT 5”
result1 = dbGetQuery(conn, q1)

Did the package change? What’s going on?

1 Like

Hi @jeff.henderson1986,

I assume you are doing the project in your local environment. Please try replacing this line:

conn = dbConnect(RSQLite(), “./factbook.db”)

with this:

conn = dbConnect(RSQLite::SQLite(), "./factbook.db")

Best,
Sahil

1 Like

OK so I got that to work but now when I run the call from the solution page:

q1 = “SELECT * FROM facts LIMIT 5”
result1 = dbGetQuery(conn, q1)

I get the following error:

Error: no such table: facts

Hi @jeff.henderson1986,

I assume you are experiencing the same situation as this one:

Best,
Sahil

I am still having trouble. the factbook.db file from https://github.com/factbook/factbook.sql/releases/tag/v0.1
is not a recognized file and even when I save it into my folder that is assigned as the working directory, the call doesn’t work…

Can you provide me some screen shots or something so we don’t have to keep going back and forth? This is taking a lot of time.

Hi @jeff.henderson1986,

Here is a screen recording :slightly_smiling_face::

Also, I am attaching the factbook.db file that I used:
factbook.db (35 KB)

Best,
Sahil

1 Like

Hi Sahil.

Thank you. This file worked. Might there be something wrong with the file hyperlinked to the lesson? Anyway, thanks for the help!

Jeff

1 Like

Hey @jeff.henderson1986 !

Do you mind marking the solution for us? This puts it on the original post and makes it easier for others to find.

To mark an answer correct/as the solution:

Scroll down to the correct post
Click on the three dots next to the reply button
Then click the check box. It will then show up in the original post, and you’re all set!
4f94d2092b683e5af57347b2cbc5a2f4411cdd90_2_690x360

Hi @jeff.henderson1986,

I just downloaded the file from the hyperlink, and it worked as expected. The most probable reason is that the file didn’t exist in your working directory so when you ran the database connection code, it created an empty factbook.db database file. I had also experienced this issue when I was learning SQLite, I downloaded the file, but the file got saved to the Downloads directory as usual. So when I ran the connection statement, it created a new database file. I was under the impression that I may have moved the file to the working directory; however, I later get to know about the empty file issue.

Best,
Sahil

Interesting. I think you are right because the file size was 0 MB in the file - which seemed very strange. Thanks for following up!

1 Like