{"id":13718682,"url":"https://github.com/clbustos/Rserve-Ruby-client","last_synced_at":"2025-05-07T10:33:42.555Z","repository":{"id":901283,"uuid":"657295","full_name":"clbustos/Rserve-Ruby-client","owner":"clbustos","description":"Pure Ruby client for Rserve. Based on  'new' Java client provided with server, but with modifications to adhere to POLS","archived":false,"fork":false,"pushed_at":"2024-05-03T04:00:39.000Z","size":221,"stargazers_count":126,"open_issues_count":12,"forks_count":27,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-11-13T02:39:23.406Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://github.com/clbustos/Rserve-Ruby-client","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/clbustos.png","metadata":{"files":{"readme":"README.md","changelog":"History.txt","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2010-05-09T04:58:27.000Z","updated_at":"2024-10-24T20:44:21.000Z","dependencies_parsed_at":"2024-01-07T21:12:25.796Z","dependency_job_id":"ebca9ed9-83fb-481f-be8e-5b3f4a8e7f9f","html_url":"https://github.com/clbustos/Rserve-Ruby-client","commit_stats":{"total_commits":154,"total_committers":13,"mean_commits":"11.846153846153847","dds":"0.20779220779220775","last_synced_commit":"eb93b5178d8d7af10db44ce42a2c0126acd77e4c"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clbustos%2FRserve-Ruby-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clbustos%2FRserve-Ruby-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clbustos%2FRserve-Ruby-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clbustos%2FRserve-Ruby-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/clbustos","download_url":"https://codeload.github.com/clbustos/Rserve-Ruby-client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224592138,"owners_count":17337045,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T01:00:35.802Z","updated_at":"2024-11-14T08:30:43.656Z","avatar_url":"https://github.com/clbustos.png","language":"Ruby","funding_links":[],"categories":["Standing on the shoulders of giants","Ruby"],"sub_categories":[],"readme":"# rserve-client\n\n* http://github.com/clbustos/Rserve-Ruby-client\n\n[![Build Status](https://travis-ci.org/clbustos/Rserve-Ruby-client.svg?branch=master)](https://travis-ci.org/clbustos/Rserve-Ruby-client)\n\n## DESCRIPTION:\n\nRuby client for Rserve, a Binary R server (http://www.rforge.net/Rserve/).\n\nFollows closely the new Java client API, but maintains all Ruby conventions when possible.\n\n## FEATURES / LIMITATIONS\n\n* 100% ruby\n* Uses TCP/IP sockets to interchange data and commands\n* Requires Rserve installed on the server machine. On debian /  ubuntu, you should use \u003ctt\u003esudo apt-get install r-cran-rserve\u003c/tt\u003e\nPros:\n* Work with Ruby 1.9.3, 2.0.0, 2.1.1, 2.3.1 (tested on Travis) and  and JRuby 1.5.\n* Retrieve and assign various R's datatypes: integer, doubles, chars, logical vectors, lists and raw data.\n* Session allows to process data asynchronously. You start a command, detach the process and retrieve result later. You can marshall the session, store on file or database and use it when you need it.\n* Ruby API follows closely the Java API, so any change on the server API could be adopted without much problem\n* Fast: 5-10 times faster than RinRuby.\n* Easy management of differences between R and Ruby, or \"You can have your cake and eat it, too!\"\n  *  From R side: The evaluation of expression retrieves REXP object, with a lot of information from original variables on R. You can construct your REXP objects and \u003ctt\u003eassign\u003c/tt\u003e them to variables on R fast using binary TCP/IP port or send complex expression without lost of time using \u003ctt\u003evoid_eval\u003c/tt\u003e \n  * Between R and Ruby: Every REXP object implements methods to convert to specific Ruby type: as_integers, as_doubles, as_strings\n  * From Ruby side: Every REXP objects has a \u003ctt\u003eto_ruby\u003c/tt\u003e method, which automagicly converts every R type on equivalent Ruby type. So, a vector of size 1 is converted to an integer or double, a vector of size\u003e1 returns an array, a named list returns a hash and so on. If you need to create a complex expression, you could always use method \u003ctt\u003eeval\u003c/tt\u003e without problem\nCons:\n* Requires Rserve\n* Limited features on Windows, caused by limitations on Rserve on this platform: single concurrent connection allowed, server crash on parse errors and can't spawn sessions.\n\n## RELATED LIBRARIES (Ruby / R)\n\n* Rinruby [http://rinruby.ddahl.org/]\n  * 100% ruby \n  * Uses pipes to send commands and evals\n  * Uses TCP/IP Sockets to send and retrieve data\n  * Pros:\n    * Doesn't requires anything but R\n    * Works flawlessly on Windows\n    * Work with Ruby 1.8, 1.9 and JRuby 1.5\n    * All API tested\n  * Cons:\n    * VERY SLOW on assignation\n    * Very limited datatypes: Only vector and Matrix\n* RSRuby\n  * C Extension for Ruby, linked to R's shared library\n  * Pros:\n    * Blazing speed! 5-10 times faster than Rserve and 100-1000 than RinRuby.\n    * Seamless integration with ruby. Every method and object is treated like a Ruby one\n  * Cons:\n    * Transformation between R and Ruby types aren't trivial\n    * Dependent on operating system, Ruby implementation and R version\n    * Ocassionaly crash\n    * Not available for alternative implementations of Ruby (JRuby, IronRuby and Rubinius)\n    \n    \n## TODO\n\nImplements\n\n* Original test\n\nSpec\n\n* Test suite on Rserve Java new API\n* First tutorial on R\n\n\n## SYNOPSIS:\n\n    require 'rserve'\n    con=Rserve::Connection.new\n    \n    # Evaluation retrieves a \u003ctt\u003eRserve::REXP\u003c/tt\u003e object\n    \n    x=con.eval('x\u003c-rnorm(1)')\n    =\u003e #\u003cRserve::REXP::Double:0x000000010a81f0 @payload=[(4807469545488851/9007199254740992)], @attr=nil\u003e\n\n    # You could use specific methods to retrieve ruby objects\n    x.as_doubles =\u003e [0.533736337958596]\n    x.as_strings =\u003e [\"0.533736337958596\"]\n    \n    # Every Rserve::REXP could be converted to Ruby objects using\n    # method \u003ctt\u003eto_ruby\u003c/tt\u003e\n    x.to_ruby =\u003e (4807469545488851/9007199254740992)\n    \n    # The API could manage complex recursive list\n    \n    x=con.eval('list(l1=list(c(2,3)),l2=c(1,2,3))').to_ruby\n    =\u003e #\u003cArray:19590368 [#\u003cArray:19590116 [[(2/1), (3/1)]] names:nil\u003e, [(1/1), (2/1), (3/1)]] names:[\"l1\", \"l2\"]\u003e\n\n    \n    # You could assign a REXP to R variables\n\n    con.assign(\"x\", Rserve::REXP::Double.new([1.5,2.3,5]))\n    =\u003e #\u003cRserve::Packet:0x0000000136b068 @cmd=65537, @cont=nil\u003e\n    con.eval(\"x\")\n    =\u003e #\u003cRserve::REXP::Double:0x0000000134e770 @payload=[(3/2), (2589569785738035/1125899906842624), (5/1)], @attr=nil\u003e\n    \n    # Rserve::REXP::Wrapper.wrap allows you to transform Ruby object to \n    # REXP, could be assigned to R variables\n    \n    Rserve::REXP::Wrapper.wrap([\"a\",\"b\",[\"c\",\"d\"]])\n    \n    =\u003e #\u003cRserve::REXP::GenericVector:0x000000010c81d0 @attr=nil, @payload=#\u003cRserve::Rlist:0x000000010c8278 @names=nil, @data=[#\u003cRserve::REXP::String:0x000000010c86d8 @payload=[\"a\"], @attr=nil\u003e, #\u003cRserve::REXP::String:0x000000010c85c0 @payload=[\"b\"], @attr=nil\u003e, #\u003cRserve::REXP::String:0x000000010c82e8 @payload=[\"c\", \"d\"], @attr=nil\u003e]\u003e\u003e\n    \n## REQUIREMENTS:\n\n* R\n* Rserve\n\n## INSTALL:\n\n  sudo gem install rserve-client\n\n## LICENSE:\n\nREngine - Java interface to R\nCopyright (C) 2004,5,6,7  Simon Urbanek \nCopyrigth (C) 2010-2017 Claudio Bustos (Ruby version)\n\nThis library is free software; you can redistribute it and/or\nmodify it under the terms of the GNU Lesser General Public\nLicense as published by the Free Software Foundation; either\nversion 2.1 of the License, or (at your option) any later version.\n\nThis library is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\nLesser General Public License for more details.\n\nYou should have received a copy of the GNU Lesser General Public\nLicense along with this library; if not, write to the Free Software\nFoundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclbustos%2FRserve-Ruby-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclbustos%2FRserve-Ruby-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclbustos%2FRserve-Ruby-client/lists"}