I have been investigating interfacing J and R using Rserve. <http://www.jsoftware.com/jwiki/Interfaces/R/Rserve>
I am interested in how best to go about working with the Attribute lists returned by the interface. For example how would I best extract the list called dist from the following structure? Rget 'sapply(head(cars), list)' +---------------------+-----------------------------+ |+------------+------+|+-----------+---------------+| ||+-----+----+|`names|||4 4 7 7 8 9|2 10 4 22 16 10|| |||speed|dist|| ||+-----------+---------------+| ||+-----+----+| || | |+------------+------+| | +---------------------+-----------------------------+ Or the levels for the structure on the wiki page? <http://www.jsoftware.com/jwiki/Interfaces/R/Rserve/Examples> +----------------------------------------------+-------+ |+--------------------+---------------+-------+|2 4 3 1| ||+----+---+-----+---+|+------+------+|`levels|| | |||four|one|three|two|||factor|`class|| || | ||+----+---+-----+---+|+------+------+| || | |+--------------------+---------------+-------+| | +----------------------------------------------+-------+ Obviously one answer is to use R to get the bits I want. Rget 'head(cars$dist)' and Rget 'levels(x) But I'm interested in how to work with these structures and symbols in J. Also it seems that something has changed because the example command given on the wiki page doesn't give the result shown on the wiki. I get this instead. Rcmd 'x=factor(c("one","two","three","four"))' Rget 'x' +-------------------------------------------------------------+-------+ |+-----------------------------------+---------------+-------+|2 4 3 1| ||+----+---+-----+------------------+|+------+------+|`levels|| | |||four|one|three|+------------+---+|||factor|`class|| || | ||| | | ||package:MASS|two|||+------+------+| || | ||| | | |+------------+---+|| | || | ||+----+---+-----+------------------+| | || | |+-----------------------------------+---------------+-------+| | +-------------------------------------------------------------+-------+ ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
