I don't believe that doing a direct SQL query on a native R object is currently 
possible, others have pointed out ways to do some of the things you would want 
SQL for using built-in R commands.

If you really want to use SQL you could transfer the data frames you want to 
use to database tables, then query those and return the result.  You may want 
to look at the RSQLite and SQLiteDF packages that would help with these steps 
without requiring any database setup outside of R.

It probably not be too much work to write a function that would take an SQL 
query as a string and a list of data frames as arguments, copy the data frames 
to SQLite tables (SQLiteDF function sql.data.frame does this), then submit the 
query on those data frames (using RSQLite package) and return the result.

Hope this helps, 


-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
[EMAIL PROTECTED]
(801) 408-8111
 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Thorsten Muehge
Sent: Wednesday, September 13, 2006 4:18 AM
To: [email protected]
Subject: [R] R-question



Hello Colleagues,
I programmed in SAS for 3 years and would like to switch to a not so costly 
software product.

Hence I started to evaluate R, and my first test look promising.

However I have some question:

1. Is it possible to query R files by SQL internally on data frames (not on a 
database) and how is the syntax (I have the RODBC package installed).

I would like to extract year, Quarter, week, from a date column in a data frame 
(see attachment). After this I want to attach the column to the original data 
frame.

How do I do this in R?

Dr .Th.Mühge,

PMP®
Procurement Technology Center
IBM Deutschland GmbH, Hechtsheimer Str.2, D-55131 Mainz
Phone: xx49-(0)6131-84-2416
Mobile: xx49-(0)15117457978
e-mail: [EMAIL PROTECTED]
(See attached file: Debug1.csv)

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to