Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9267269
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T14:30:43+00:00 2026-06-18T14:30:43+00:00

Using RMySQL I want to load data from a database into a dataframe in

  • 0

Using RMySQL I want to load data from a database into a dataframe in R. For this I’m using the following code:

Rconnectdb:

con <- dbConnect(MySQL(),
user="root", password="password",
dbname="prediction", host="localhost")

Main code

library(RMySQL)
source("Rconnectdb") #load the database connection
query = "select received,isRefound from message" #specify query
rs=dbGetQuery(con,query) #resultset
dataset <- fetch(rs, n=-1) #fill dataset with all rows of the resultset
dbClearResult(rs) #clear resultset

Executing this I get the following error

Error in function (classes, fdef, mtable) : unable to find an
inherited method for function “fetch”, for signature “data.frame”,
“numeric”

Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T14:30:44+00:00Added an answer on June 18, 2026 at 2:30 pm

    You’re mistaking dbSendQuery with dbGetQuery.
    dbGetQuery combine dbSendQuery, fetch and dbClearResult as per documentation:

    The function dbSendQuery only submits and synchronously executes the SQL statement to the database engine. It does not extracts any records — for that you need to use the function fetch (make sure you invoke dbClearResult when you finish fetching the records you need).

    The function dbGetQuery does all these in one operation (submits the statement, fetches all output records, and clears the result set).

    From ?dbGetQuery in package DBI.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using this code, the following execution yields strange results: C 100 R W The
I want to build a package that involves loading data from mysql using different
I am extracting some data from a db using R and RMySQL and the
Using MongoDB C# Driver (official form 10gen), I'm doing the following code: using (database.RequestStart())
Using this is very helpful when trying to generate html code in c#. var
Using ember 1.0.0-pre3 I have a little app that has this code: window.App =
using xmltextreader, how would I load a hashtable. XML: <base><user name=john>2342343</user><user name=mark>239099393</user></base> This was
using this code: Java Server side: ... out = new PrintWriter(this.client.getOutputStream(), true); ... public
Using Android NDK is it possible (from native C-code) to get a list of
Using the DateTime class, if I try to run the following code: $mydate =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.