« View all new features in
Mathematica
9
◄
previous
|
next
►
New in
Mathematica
9
›
Built-in Integration with R
Compute Frequencies of Random Integers
First, load and install the R runtime and generate random data. Compute the frequencies of elements and return them as a data frame that can be viewed as a table.
In[1]:=
X
Needs["RLink`"] InstallR[]
In[2]:=
X
rnd = RandomInteger[15, 10^5];
In[3]:=
X
(freqs = RFunction["function(data){as.data.frame(table(data))}"][ rnd]) // AbsoluteTiming
Out[3]=
In[4]:=
X
TableForm[freqs]
Out[4]//TableForm=