[R] R, RMysql, and MySQL 5 Decimal Type Support
Jason Trimble
jason at bodymedia.com
Wed Mar 29 23:06:36 CEST 2006
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
More information about the R-help
mailing list