I would like to know if Java supports “casting and melting” of data somehow. By “casting and melting” I mean “reshaping” data in the way that the R package reshape ( or reshape2) does.
So I have a SQL query that returns the following ( in a ResultSet ) :
---------------------
|Id | Key | Value|
---------------------
|1 | Name | John |
|1 | Gender | Male |
|1 | Country| U.S |
|2 | Name | Tom |
|2 | Gender | Male |
|2 | Country| Cuba |
---------------------
I want to reshape this data so that I can get this :
------------------------
|Id|Name|Gender|Country|
------------------------
|1 |John|Male |U.S |
|2 |Tom |Male |Cuba |
------------------------
How do Java programmers achieve this transformation ?
Not directly. R is more focused on data while Java is more of a general purpose language and lacks some of the various specific functions. You can either program something yourself; or use a “ETL” (Extract, Transform, Load) tool such as Kettle http://kettle.pentaho.com/