[R] How to get a table of MySQL database as a matrix variable in R
Prof Brian Ripley
ripley at stats.ox.ac.uk
Tue Feb 1 13:15:28 CET 2005
On Tue, 1 Feb 2005, Willie Y. CHEN wrote:
> It seems that the dbReadTable() method provided by RMySQL could not
> get rid of the headers, neither the index column... So
>
> 1. Can I use read.table() method to get a table of MySQL database?
>> From the help document the argument of 'file' of read.table() method
> could be a connection...
?connection will tell you what that is: it is nothing to do with RMySQL.
> 2. How can I obtain a matrix from the database table contains all
> elements except the headers and the index column?
We don't know what you have tried, but note that dbReadTable (and
read.table) return data frames, not matrices, and data frames must have
row names and (column) names. You probably need to research the
difference between a matrix and a data frame.
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help
mailing list