Hi, Whenever I have a MySQL query that returns a Decimal result to R I get the following warning in R: Warning message: RS-DBI driver warning: (unrecognized MySQL field type 246 in column 1) I get this for a simple query like "SELECT 2, 2.5" !! I am using: R ver 2.1.1 RMySQL ver. 0.5-7 DBI ver. 0.1-10 MySQL Ver 14.12 Distrib 5.0.18. Please Help! Jason [[alternative HTML version deleted]]
> Whenever I have a MySQL query that returns a Decimal result to R I get > the following warning in R: > I get this for a simple query like "SELECT 2, 2.5" !! > Warning message: > RS-DBI driver warning: (unrecognized MySQL field type 246 in column 1) >If I understand what you are saying, I think you have garbled SQL syntax. The select statement synatx is: SELECT list_of_columns FROM tables[s] [WHERE search_conditions] My guess is that you don't have columns named 2 or 2.5 Rob ____________________________ Robert W. Baer, Ph.D. Associate Professor Department of Physiology A. T. Still University of Health Science 800 W. Jefferson St. Kirksville, MO 63501-1497 USA ----- Original Message ----- From: "Jason Trimble" <jason at bodymedia.com> To: <r-help at stat.math.ethz.ch> Sent: Tuesday, March 28, 2006 12:08 PM Subject: [R] R, RMysql, and MySQL 5 Decimal Type Support> Hi, > > > > > > > >> > > > I am using: > > R ver 2.1.1 > > RMySQL ver. 0.5-7 > > DBI ver. 0.1-10 > > MySQL Ver 14.12 Distrib 5.0.18. > > > > Please Help! > > Jason > > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide!http://www.R-project.org/posting-guide.html>
Hi, MySQL data type 246 is the new (as of version 5.0?) fixed precision DECIMAL type, which doesn't map to any existing R type. In most cases, I believe, it is imported as an R character vector, and you can just coerce it to numeric, i.e., to floating point precision. Next version of RMySQL will address this issue, and comments regarding what would be a suitable R type for SQL fixed DECIMALs are welcome. -- David Jason Trimble wrote:> Hi, > > > > Whenever I have a MySQL query that returns a Decimal result to R I get > the following warning in R: > > > > Warning message: > > RS-DBI driver warning: (unrecognized MySQL field type 246 in column 1) > > > > I get this for a simple query like "SELECT 2, 2.5" !! > > > > I am using: > > R ver 2.1.1 > > RMySQL ver. 0.5-7 > > DBI ver. 0.1-10 > > MySQL Ver 14.12 Distrib 5.0.18. > > > > Please Help! > > Jason > > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
That is interesting to find out since on RMySQL module site (http://stat.bell-labs.com/RS-DBI/download/) it says the following for the latest version: "RMySQL 0.5-7 built with R 2.2.1 and MySQL 5.0.18" which is now obviously not entirely true, seeing as how that is what I am using. :) It there any type of release schedule for a new RMySQL? Also, I tried coercing the vector into a numeric but get the following: (this is just a simple example)>grdata = dbGetQuery(connection, "select 2 as age, 2.5 as hours"); >attach(grdata); >test = as.numeric(grdata["hours"]);Error in as.double.default(grdata["hours"]) : unimplemented type 'character' in 'asReal' I can run the same command on the age (2) value with no errors. It just does not like the 2.5 at all! -----Original Message----- From: David James [mailto:dj at research.bell-labs.com] Sent: Tuesday, March 28, 2006 11:08 PM To: Jason Trimble Cc: r-help at stat.math.ethz.ch Subject: Re: [R] R, RMysql, and MySQL 5 Decimal Type Support Hi, MySQL data type 246 is the new (as of version 5.0?) fixed precision DECIMAL type, which doesn't map to any existing R type. In most cases, I believe, it is imported as an R character vector, and you can just coerce it to numeric, i.e., to floating point precision. Next version of RMySQL will address this issue, and comments regarding what would be a suitable R type for SQL fixed DECIMALs are welcome. -- David Jason Trimble wrote:> Hi, > > > > Whenever I have a MySQL query that returns a Decimal result to R I get > the following warning in R: > > > > Warning message: > > RS-DBI driver warning: (unrecognized MySQL field type 246 in column 1) > > > > I get this for a simple query like "SELECT 2, 2.5" !! > > > > I am using: > > R ver 2.1.1 > > RMySQL ver. 0.5-7 > > DBI ver. 0.1-10 > > MySQL Ver 14.12 Distrib 5.0.18. > > > > Please Help! > > Jason > > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide!http://www.R-project.org/posting-guide.html