R and Calc Documentation
From Apache OpenOffice Wiki
Please note that this documentation is not for Version 0.1.0, but rather for an upcoming release. See the main R and Calc page for current documentation.
Cell Functions
Note that the function names may change in future versions... I'm not really concerned about properly naming everything for users yet, but making things simpler for development.
- RNDBLMAT( <command> , <matrix> , <matrix>): passes a command and two matrices. For example, RNDBLMAT("cov";A1:A100;B1:B100).
- RNMAT( <command> , <matrix> ): passes a command and matrix as a parameter. For example, RNNUM("var";A1:A100).
- RNNUM( <command> , <number> ): passes a command and a numeric parameter. For example, RNNUM("rnorm"; 1).
- RNUMPROP( <command> , <property> ): passes a command to R and prints a specific property from the output. This is useful if the values returned from R aren't numeric but contain a variety of information. For example, RNUMPROP("cor.test(c(1,2,3,4), c(1,2,2,3))"; "p.value").
- RSIMPLENUM( <command> ): passes a command to R, prints a number if one is returned.
- RTESTCONNECTION(): tests R connection (for RServe).
R Add-On Menu
- RDUMP(): creates a new spreadsheet with the object structure returned by a specific R script.
Tips & Tricks
Running External Libraries
At this time, it's not possible to load libraries ahead of time using Rserve. However, you can load a library through a function cell. The example below loads a library called sna and calls a function, passing a matrix as a parameter. Note that the library needs to be installed prior to using it.
RNMAT("library(sna);gden"; A1:D4)