[R-SIG-Finance] Does anybody know how to connect to KDB from within R?
Daniel Cegielka
daniel.cegielka at gmail.com
Fri Sep 25 00:25:29 CEST 2009
Michael pisze:
> Cool!
>
> I've seen the following files in that folder:
>
> Index of /q/interfaces/r/w32
>
> Name Last modified Size Description
> Parent Directory -
> R.dll 12-Feb-2009 18:58 2.7M
> c.o 12-Feb-2009 18:58 23K
> k.h 12-Feb-2009 18:58 3.3K
> kdbplus.R 19-Feb-2009 03:21 420
> kdbplus.dll 12-Feb-2009 18:58 66K
> kdbplus.o 11-Feb-2009 08:30 14K
>
>
> How do I install these files to my R-system?
>
> Thanks!
>
I have linux. You can keep this files in any place.. and simply paste
localisation in this line
dyn.load("c:/my_files/q/interfaces/r/w32/kdbplus.dll")
edit kdbplus.R
or from R:
> source(kdbplus.R)
daniel
>
>
> On Thu, Sep 24, 2009 at 2:54 PM, Daniel Cegielka
> <daniel.cegielka at gmail.com> wrote:
>
>> Brian G. Peterson pisze:
>>
>>> Also, you may wish to read Dirk's post and related posts on the list
>>> archives here regarding POSIXct compatibility:
>>>
>>> http://dirk.eddelbuettel.com/blog/2009/02/03/#kdbplus_datetime_patch
>>>
>> http://groups.google.com/group/personal-kdbplus/browse_thread/thread/f3271f5cf534c67f
>>
>> This patch is build in kdbplus.c (line: 470-489):
>>
>> https://code.kx.com/trac/browser/kx/kdb%2B/interfaces/r/kdbplus.c
>>
>>
>>
>>> Re: [R-SIG-Finance] Does anybody know how to connect to KDB from
>>>
>> within R?
>>
>> yes:
>>
>> run: ~/q/l32/q -p 5000
>>
>> R session:
>>
>> # dyn.load(file.path("/home/kdeplus/.../q","l64"))
>> # con <-
>> .Call("kx_r_open_connection",list(host="localhost",as.integer(port=5000),user=NULL))
>> # execute <- function(con,query) {
>> .Call("kx_r_execute",as.integer(con),query)
>> }
>> # execute(con,"s:([] name:`A`B`C; var:10 20 30)")
>> # execute(con, "select from s")
>>
>>
>> best,
>> daniel cegielka
>>
>>
More information about the R-SIG-Finance
mailing list