« View all new features in
Mathematica
9
◄
previous
|
next
►
New in
Mathematica
9
›
Built-in Integration with R
Create and Display Data Frames
Mathematica
can work with tables of data stored in R data frames.
First, load and install the R runtime. Then define an R data frame, compute subframes, and visualize the subframe data.
In[1]:=
X
Needs["RLink`"] InstallR[]
In[2]:=
X
REvaluate[" { age = 18:23 height = c(76.1,77,78.1,78.2,78.8,79.7) name = c(\"John Young\",\"Jane Ty\",\"John Ed\",\"Mary \ Ann\",\"Thomas Ed\",\"John Wood\") village = data.frame(age=age,height=height,name=name) as.data.frame(village) } "]
Out[2]=
In[3]:=
X
sub = REvaluate["village[village$height>78,]"]
Out[3]=
In[4]:=
X
TableForm[sub]
Out[4]//TableForm=