Monday, May 17, 2010

Another quick example

The lower R line obtains the first 20 lines from database db and table tb, returning the first column as standard date.

strptime(qrl(tb,db)$V1,"%Y-%m-%d")

So, I use short hand names. The R functions starting with q are from the 100 Essentials. Another thing I short is tabs, they are not allowed in the working data except as column separators. Another rule, I keep file and table names exactly the same.
Normally when cruising the net and I come across a table, then I am either a save link which often works. I do that a lot, the data often landing in a form at least readable by a spreadsheet.

On time conversion,my standard unit of time is the year to two decimal places.

Generally I can get it into SQL by three, at least, methods, it eventually ends up as a tab delimited file. Once it is in the common directory, then it appears, the R funtion dir() gets that file as part of an array, from there as a table in SQLite without trouble. I use SQLite, really, as R variable storage.

I jeep all special view creation strings, query strings for specific data sets in R source code as simple constant definitions. I have a set for the BLS data, for example.


Where to from here?

Actually, I am still on this idea of SQL managed data for a robotic vision aid, especially for robotic vehicles. I know Google is to, obviously.

No comments: