is there any way how to create something like data.frame object in R that would point to specific table in MySQL database and would behave like data.frame? I haven’t been able to find any mention about it.
As an example, let us say, I have a table called customers and columns names, heights, weights and I would like some function, that would create variable customer and I could access the respective columns in data.frame-like way, i.e. customer$heights, etc.
My problem is that I am working with very large datasets and operating over database is much faster and one might actually hack some descriptive statistics in SQL to be used with such pointer variable, for example sum, average, etc…
Thanks for answer.
T.
Yes, external pointers can do that, and the RODBC package uses it. See the “Writing R Extensions” manual for an introduction to external pointers.
The ff, bigmemory and mmap package may give you ideas about how to make external data appear internal to R. It can be done, but it’s not a quick hack for a rainy afternoon.
And in general, one is generally best off doing as much computation ‘near the data’ as possible. Were you using PostgreSQL, you could try the embedded Pl/R extension for it. To my knowledge, no such extension exists for MySQL.