Coder Social home page Coder Social logo

py361 / embedr Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kxsystems/embedr

0.0 2.0 0.0 42 KB

Embedding R inside q

Home Page: http://code.kx.com/q/interfaces/with-r/#calling-r-from-q

License: Apache License 2.0

Makefile 1.82% C 86.68% q 10.74% Shell 0.76%

embedr's Introduction

embedR: Embedding R inside q

See Kx wiki http://code.kx.com/q/interfaces/with-r/#calling-r-from-q

Installation

Download

Download the appropriate release archive from releases page.

Unpack and install content of the archive

environment action
Linux tar xzvf embedr_linux-v*.tar.gz -C $QHOME --strip 1
macOS tar xzvf embedr_osx-v*.tar.gz -C $QHOME --strip 1
Windows Open the archive and copy content of the embedr folder (embedr\*) to %QHOME% or c:\q
Copy R_HOME/x64/.dll or R_HOME/i386/.dll to QHOME/w64 or QHOME/w32 respectively.

Calling R

When calling R, you need to set R_HOME. Required are:

# Linux/macOS
export R_HOME=`R RHOME`
# Windows
for /f "delims=" %a in ('R RHOME') do @set R_HOME=%a

The library has four main methods:

  • Ropen: Initialise embedded R. Optional to call. Allows to set verbose mode as Ropen 1.
  • Rcmd: run an R command, do not return a result
  • Rget: run an R command, return the result to q
  • Rset: set a variable in the R memory space

Interactive plotting

If using interactive plotting with lattice and/or ggplot2 you will need to call print on chart object.

Examples

See examples folder.

Note: Examples are kdb+ 3.5 or higher.

Example 1.

e4.q is a simple example of plot 'moving window volatility' of returns. Converted from http://www.mayin.org/ajayshah/KB/R/html/p4.html

Example 2.

pcd.q is based on Corporate credit card transactions 2014-15.

Please download csv file from the link above and place it in the same folder as pcd.q under name pcd2014v1.csv.

Example 3.

http://data.london.gov.uk/datastore/package/tubenetwork-performance-data

Left for the reader :)

embedr's People

Contributors

charlieskelton-kx avatar sv avatar

Watchers

James Cloos avatar 500-9 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.