{"id":25806021,"url":"https://github.com/alipsa/renjin-client-data-utils","last_synced_at":"2026-06-17T14:32:16.653Z","repository":{"id":57742906,"uuid":"304882649","full_name":"Alipsa/renjin-client-data-utils","owner":"Alipsa","description":"Utilities to facilitate working with R data from Renjin in Java","archived":false,"fork":false,"pushed_at":"2022-05-27T14:59:47.000Z","size":61,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-07T10:05:56.003Z","etag":null,"topics":["jvm","renjin"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Alipsa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":["Alipsa"]}},"created_at":"2020-10-17T13:21:29.000Z","updated_at":"2022-02-16T20:05:21.000Z","dependencies_parsed_at":"2022-09-11T09:41:29.605Z","dependency_job_id":null,"html_url":"https://github.com/Alipsa/renjin-client-data-utils","commit_stats":null,"previous_names":["pernyfelt/renjin-client-data-utils"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/Alipsa/renjin-client-data-utils","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alipsa%2Frenjin-client-data-utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alipsa%2Frenjin-client-data-utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alipsa%2Frenjin-client-data-utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alipsa%2Frenjin-client-data-utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Alipsa","download_url":"https://codeload.github.com/Alipsa/renjin-client-data-utils/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alipsa%2Frenjin-client-data-utils/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34453431,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-17T02:00:05.408Z","response_time":127,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["jvm","renjin"],"created_at":"2025-02-27T19:52:41.039Z","updated_at":"2026-06-17T14:32:16.639Z","avatar_url":"https://github.com/Alipsa.png","language":"Java","funding_links":["https://github.com/sponsors/Alipsa"],"categories":[],"sub_categories":[],"readme":"# renjin-client-data-utils\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/se.alipsa/renjin-client-data-utils/badge.svg)](https://maven-badges.herokuapp.com/maven-central/se.alipsa/renjin-client-data-utils)\n[![javadoc](https://javadoc.io/badge2/se.alipsa/renjin-client-data-utils/javadoc.svg)](https://javadoc.io/doc/se.alipsa/renjin-client-data-utils)\n\nUtilities to facilitate working with R data from Renjin in Java. In R, there are various basic \ndata structures such as matrix and data.frame and are faithfully backed by Java classes such as \nListVector for data.frame that while very easy to work with in R, can be a bit cumbersome to work with\ndirectly in Java. This library aims to simplify working with data derived from Renjin R from Java code. \n\nTo use it add the following dependency to your pom.xml:\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003ese.alipsa\u003c/groupId\u003e\n    \u003cartifactId\u003erenjin-client-data-utils\u003c/artifactId\u003e\n    \u003cversion\u003e1.5.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\nNote: 1.5.0 and later requires java 11, previous version required java 8.\n\n## se.alipsa.renjin.client.datautils.Table\nThe Table class makes it easy to interact with R data.frame and matrix data.\nData frames in R are \"column based\" (variable based) which is very convenient for analysis but Java is\nObject / Observation based, so a Table which essentially is just a List of rows (observations), makes is much easier\nto work with the data in Java. The data in a Table is immutable once created. If you need mutable data,\nconsider using RDataTRansformer instead (see below).\n\n### Example:\n\nGiven the following R code:\n```r\nemployee \u003c- c('John Doe','Peter Smith','Jane Doe')\nsalary \u003c- c(21000, 23400, 26800)\nstartdate \u003c- as.Date(c('2013-11-1','2018-3-25','2017-3-14')) \nendDate \u003c- as.POSIXct(c('2020-01-10 00:00:00', '2020-04-12 12:10:13', '2020-10-06 10:00:05'), tz='UTC' ) \ndata.frame(employee, salary, startdate, endDate)\n```\n\nI.e a two dimensional table looking like this:\n\n| employee    | salary | startdate | enddate             |\n| --------    | -----: | --------- | -------             |\n| John Doe    |  21000 | 2013-11-1 | 2020-01-10 00:00:00 |\n| Peter Smith |  23400 | 2018-3-25 | 2020-04-12 12:10:13 |\n| Jane Doe    |  26800 | 2017-3-14 | 2020-10-06 10:00:05 |\n\n... you create it in the RenjinScriptEngine like this:\n\n```java\nimport org.renjin.script.RenjinScriptEngine;\nimport org.renjin.sexp.SEXP;\nimport se.alipsa.renjin.client.datautils.Table;\n\npublic class Example {\n\n  RenjinScriptEngine engine;\n\n  public Example() {\n    RenjinScriptEngineFactory factory = new RenjinScriptEngineFactory();\n    Session session = new SessionBuilder().withDefaultPackages().build();\n    engine = factory.getScriptEngine(session);\n  }\n\n  public Table getData(String code) {\n    SEXP sexp = (SEXP) engine.eval(code);\n    return Table.createTable(sexp);\n  }\n}\n```\n... the following assertions would be valid for the Table returned by the getData() method:\n```javascript\nassertThat(table.getValue(0, 0), equalTo(\"John Doe\"));\nassertThat(table.getValue(1, 1), equalTo(23400.0));\nassertThat(table.getValueAsLocalDate(2, 2), equalTo(LocalDate.of(2017, 3, 14)));\nassertThat(table.getValueAsLocalDateTime(2, 3), equalTo(LocalDateTime.of(2020, 10, 6, 10, 0, 5)));\n```\nAs you see from the above we access the Table data in a row, column way which makes it easy to \ndisplay the data in Swing or JavaFx.\n\nSee [TableTest](src/test/java/test/alipsa/renjin/client/datautils/TableTest.java) for more examples. \n\n## se.alipsa.renjin.client.datautils.RDataTransformer\n\nThis is a utility class that transforms various R data types into Java.\nIn many ways it is similar to the Table class but allows for more atomic operations\nuseful when you only want the result in a particular way once, or you need mutable data.\n\nSee [DataTransformationTest](src/test/java/test/alipsa/renjin/client/datautils/DataTransformationTest.java) for examples.\n\n# Version history\n\n### 1.5.1\nAdd automodule info\n\n### 1.5.0\nUpgrade to java 11, no module info though (not possible due to BLAS dependencies)\n\n### 1.4.4\n- Add constructor for column wise constructing of a table\n- Add a DateArrayVector to handle column wise constructing of data types\n\n### 1.4.3\n- make the convenience methods more robust and performing a conversion (if possible) into \n  the type requested\n- Add more Javadocs\n- Add conversion from Vectors (c() and list() constructs in R) to java.util.List\n- Bump dependency versions for spotbugs and junit\n\n### 1.4.2\n- If no info on column types are given when creating a table then treat them as Strings\n- Add customizable decimal format awareness for getAsFloat and getAsDouble convenience methods.\n- Bump dependency versions for spotbugs and require maven 3.6.3 or higher for cleaner output \n\n### 1.4.1\nHandle transformations of empty tables (used to get an ArrayIndexOutOfBoundsException) - now returning empty List instead\n\n### 1.4\nFix handling of factorized columns with NA values\nChange Row naming to use an IntSequence instead of the no longer existing RowNamesVector(numberOfRows)\nBump dependency versions\n\n### 1.3\nadd Table column convenience methods (getColumnForName, getColumnIndex, getColumn)\nMake Table data immutable, this allows for some performance optimizations and makes usage much clearer\n(Table to process data from Renjin, RDataTransformer to handle mutable data to and from Renjin)\n\n### 1.2\n- Add docs\n- cleanup and expand tests\n- add @SafeVarargs to Table constructor to silence compiler warning which does not apply\n- add getRowForName providing the ability to find a row based on a cell value\n\n### 1.1\n- Add some utility methods, so we can remove the Ride version of the same class.\n- Add docs\n\n### 1.0 \n- Initial version","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falipsa%2Frenjin-client-data-utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falipsa%2Frenjin-client-data-utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falipsa%2Frenjin-client-data-utils/lists"}