Giter Site home page Giter Site logo

octave.connect's Introduction

octave.connect

This package defines a knitr engine that connects to Octave and passes it a command defining an array based on an R array.

Installation

You can install the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("zandergordan/octave.connect")

Example

Here is a basic example of using the package. First, anywhere in your rmarkdown file (typically in the setup) chunk:

library(octave.connect)
octave_connect("C:\\Users\\alexander.gordan\\AppData\\Local\\Programs\\GNU Octave\\Octave-6.1.0\\mingw64\\bin\\octave")

Then, define an R array:

example_array <- array(data = 1:16, dim = c(4,4))
example_array
#>      [,1] [,2] [,3] [,4]
#> [1,]    1    5    9   13
#> [2,]    2    6   10   14
#> [3,]    3    7   11   15
#> [4,]    4    8   12   16

And now we can use an octave_connect chunk to do things with the array in Octave (to view the full syntax, look at README.rmd instead of the rendered README.md):

sum(example_array)
#> ans =
#> 
#>    10   26   42   58

octave.connect's People

Contributors

zandergordan avatar

Watchers

 avatar

octave.connect's Issues

Wrap contents of octave_connect.R in a function

The function should take one argument: the path to the user's Octave binary. Then, to use the package, users simply add the following to their setup chunk in their .rmd:

library(octave_connect)
octave_connect("path/to/octave")

switch to tempfile approach

Currently, octave_connect calls octave --eval, meaning that the R array is passed through the command line, which has a character limit of 8191 characters (on windows). It will be more robust to create a temporary file with the data (and the code for manipulating that data) and call octave tempfile.txt.

Add plotting functionality

this can be done by adding a new line in the engine that also sends the working directory of the .rmd to Octave, and then using that directory when calling octave's print to file command on a plot.

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.