This is just a basic sample to get started using R with Excel.
I followed these steps to create the add-in:
-
Ensure that R is installed from https://cran.r-project.org/bin/windows/base/ The bitness of the R installation must match that of Excel. Note that v4.1.3 is the last version to support 32bit.
-
Create a new "Class Library" project in Visual Studio.
-
In the NuGet package Manager Console, execute the commands:
PM> Install-Package ExcelDna.Addin PM> Install-Package R.NET -
Add the sample code from AddIn.cs.
-
F5 to run the add-in in Excel.
-
Enter the formula =TestRDotNet()
and=MyRNorm(5)`. Numbers appear in Excel.
-
The R project, including links to the R installation is at, http://www.r-project.org/
-
The R.NET project is at https://github.com/rdotnet/rdotnet