Right now I have added a utility to create an Sqlite table in the exact image of an R Stat data frame, matching columns names. So variable names are consistent across.
This code creates an R based data frame from the 12 table of the database db;
> y <- qrl(tb[12],db,mode="h")
> y
idx Year Value
1 1 1971.44 37.9
2 2 1971.52 38.1
3 3 1971.61 38.3
I have a small utility.r file which contains an insertTable function that creates an SQL table t match an R based data frame.
insertTable(x)
So my general strategy is to reading data to R, make sure the headers look of, edit as needed, then insert the dataf rame into a table.
My 100 Essentials have been update on the right of the web page.
Showing posts with label SQLite R project. Show all posts
Showing posts with label SQLite R project. Show all posts
Monday, May 24, 2010
Monday, May 10, 2010
My database
Searching reams of spreadsheet files, plotting them. Not ready for prime time, but becoming So I am,just now creating id approximations, namely taking chunks of the first few columns and letting the user sort through and search through known list of final data. From SQLite, every thing arriving is a data frame, generally extracted for many databases. and all of it in csv like constructions.
Why approximate searches? Because it relieves the load of managing meta data, all the stuff about exact formats. So, a researcher can throw something from a spread sheet into the search bin, irregularly, not bothering with formal definitions. The mild rule of maximizing entropy a bit, keep the habit of using the left hand columns for data id type information, of generally fewer bytes.
So, in R these become lists of text, best guesses at data, and text look up when the series id is known. But I need tighter SQLite, R integration.
Like this little query just does one of a few query types on a spreadsheet of text describing data, for example.
Why approximate searches? Because it relieves the load of managing meta data, all the stuff about exact formats. So, a researcher can throw something from a spread sheet into the search bin, irregularly, not bothering with formal definitions. The mild rule of maximizing entropy a bit, keep the habit of using the left hand columns for data id type information, of generally fewer bytes.
So, in R these become lists of text, best guesses at data, and text look up when the series id is known. But I need tighter SQLite, R integration.
Like this little query just does one of a few query types on a spreadsheet of text describing data, for example.
CREATE VIEW colQuery AS
select f1,f2,f3,f4 from U,words
Where (
(U.w1 = 'OR2' or U.w1 = 'AnY')
and
(words.f2 like U.w2 or words.f2 like U.w3)
or (
(U.w1 = 'AND2'or U.w1 = 'EQU')
and
words.f2 like U.w2 and words.f2 like U.w3
)or(
(U.w1 = 'OR1' or U.w1 = 'EQU')
and words.f1 like U.w2
)or(
(U.w1 = 'OR3' or U.w1 = 'ANY')
and words.f3 like U.w2 )
)
union select * from U
where U.w2 = 'ECHO' ;
Subscribe to:
Posts (Atom)