# How can I call the R-programming packages in my Mathematica?

I am trying to call the R-programming package called highfrequency in my Mathematica so that I can use its function rCov. I tried to call this by using

Needs["RLink"];
InstallR[];
install.packages;
REvaluate["library(highfrequency)"]


Then, I receive the following error:

REvaluate::rerr: Failed to retrieve the value for variable or piece of code
library(highfrequency). The following R error was encountered: Error in library
(highfrequency) :
there is no package called 'highfrequency' >>


This error is the same no matter what different R-packages I call within Mathematica. However, I think the Mathematica command REvaluate may not be appropriate in calling R-packages. May I know how I can resolve this issue?

• I'm afraid I don't know what realized covariance means. Perhaps the easiest solution is to use RLink and directly use the R implementation. Otherwise, please edit the question with enough information so that we can construct such a function -- perhaps with an example showing what calculation you desire to implement. – bill s Nov 18 '14 at 15:07
• @bill s: Thanks a lot. Then may I know how I can use RLink and directly use the R implementation? I have never tried in that way before. – Eric Nov 19 '14 at 0:16
• You need to install R the package first using install.packages. With RLink this is only possible on Windows. Otherwise you can install the package into an external R installation (separate from RLink), then set up RLink to use this external R – Szabolcs Nov 19 '14 at 16:31
• It looks like this package was removed from CRAN though ... cran.r-project.org/web/packages/highfrequency/index.html – Szabolcs Nov 19 '14 at 16:37
• @Szabolcs: Ah..now it works. The InstallR[] was not supposed to be mixed with my command. After I removed it, it gave me the correct version. Thank you very much! – Eric Nov 20 '14 at 20:45

• Thanks. But if I have a certain R-command like rCov only unique to the R-package called highfrequency but not a general R-command, do you know how possibly I can bring either the highfrequency package and/or the rCov command unique only to the highfrequecy` package? – Eric Nov 19 '14 at 15:46