Click here to Skip to main content
15,886,736 members
Home / Discussions / C#
   

C#

 
QuestionHow to export a result table and charts from RDotNet to Excel Pin
Member 1085025317-Jun-16 15:45
Member 1085025317-Jun-16 15:45 
AnswerRe: How to export a result table and charts from RDotNet to Excel Pin
Garth J Lancaster17-Jun-16 16:40
professionalGarth J Lancaster17-Jun-16 16:40 
GeneralRe: How to export a result table and charts from RDotNet to Excel Pin
Member 1085025323-Jun-16 11:41
Member 1085025323-Jun-16 11:41 
GeneralRe: How to export a result table and charts from RDotNet to Excel Pin
Garth J Lancaster23-Jun-16 16:12
professionalGarth J Lancaster23-Jun-16 16:12 
GeneralRe: How to export a result table and charts from RDotNet to Excel Pin
Member 1085025323-Jun-16 16:22
Member 1085025323-Jun-16 16:22 
QuestionCan't get the replace to work, and double check my work. Pin
jkirkerx17-Jun-16 11:11
professionaljkirkerx17-Jun-16 11:11 
AnswerMy Bad, perhaps I can just get that double check Pin
jkirkerx17-Jun-16 11:19
professionaljkirkerx17-Jun-16 11:19 
QuestionError while trying to use R.Net in VS 2012 Pin
Member 1085025317-Jun-16 5:39
Member 1085025317-Jun-16 5:39 
I followed the tutorial here:
Importing and displaying a Data frame with C# and R.NET | Psychwire[^]
and I got errors on the code, here:
REngine.SetDllDirectory(dlldir);
      REngine.CreateInstance("RDotNet");
REngine engine = REngine.GetInstanceFromID("RDotNet");
engine.EagerEvaluate("dataset<-read.table(file.choose(), header=TRUE, sep = ',')");
DataFrame dataset = engine.EagerEvaluate("dataset").AsDataFrame();
saying that it couldn't find the methods inRDotNet.Engine.
This is the code I am using:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Microsoft.Win32;
using RDotNet;
using RDotNet.NativeLibrary;
using Microsoft.Win32;

namespace RScript
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            string dlldir = @"C:\Program Files\R\R-3.3.0\bin\x64";
            bool r_located = false;
            Environment.SetEnvironmentVariable("PATH", Environment.GetEnvironmentVariable("PATH") + ";" + dlldir);
            InitializeComponent();    

            while (r_located == false)
            {
                try
                {
                    REngine.SetDllDirectory(dlldir);
                    REngine.CreateInstance("RDotNet");
                    r_located = true;
                }

                catch
                {
                    MessageBox.Show(@"Unable to find R installation's \bin\i386 folder.
                    Press OK to attempt to locate it.");

                    /if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
                    {
                        dlldir = @folderBrowserDialog1.SelectedPath;
                    }/

                }
            }

        }

        private void button1_Click(object sender, EventArgs e)
        {
            REngine engine = REngine.GetInstanceFromID("RDotNet");

            try
            {
                // import csv file
                engine.EagerEvaluate("dataset<-read.table(file.choose(), header=TRUE, sep = ',')");

                // retrieve the data frame
                DataFrame dataset = engine.EagerEvaluate("dataset").AsDataFrame();

                for (int i = 0; i < dataset.ColumnCount; ++i)
                {
                    dataGridView1.ColumnCount++;
                    dataGridView1.Columns[i].Name = dataset.ColumnNames[i];
                }

                for (int i = 0; i < dataset.RowCount; ++i)
                {
                    dataGridView1.RowCount++;
                    dataGridView1.Rows[i].HeaderCell.Value = dataset.RowNames[i];

                    for (int k = 0; k < dataset.ColumnCount; ++k)
                    {
                        dataGridView1[k, i].Value = dataset[i,k];

                    }

                }

            }

            catch
            {
                MessageBox.Show(@"Equation error.");
            }
        }

    }
}
can someone please help me out, since I really need your help?
I am new to R.Net.
I am using the newest version of RDotNet (1.6.5).
Thanks in advance!
AnswerRe: Error while trying to use R.Net in VS 2012 Pin
OriginalGriff17-Jun-16 5:47
mveOriginalGriff17-Jun-16 5:47 
QuestionHelp me gather info about multiple monitors Pin
Tomaž Štih17-Jun-16 3:41
Tomaž Štih17-Jun-16 3:41 
AnswerRe: Help me gather info about multiple monitors Pin
BillWoodruff17-Jun-16 23:52
professionalBillWoodruff17-Jun-16 23:52 
GeneralRe: Help me gather info about multiple monitors Pin
Tomaž Štih18-Jun-16 3:52
Tomaž Štih18-Jun-16 3:52 
GeneralRe: Help me gather info about multiple monitors Pin
BillWoodruff18-Jun-16 19:06
professionalBillWoodruff18-Jun-16 19:06 
QuestionI want to show my GPS cursor in Mapwingis, how to do it? Pin
Member 1241411416-Jun-16 3:55
Member 1241411416-Jun-16 3:55 
AnswerRe: I want to show my GPS cursor in Mapwingis, how to do it? Pin
Pete O'Hanlon16-Jun-16 21:40
mvePete O'Hanlon16-Jun-16 21:40 
GeneralRe: I want to show my GPS cursor in Mapwingis, how to do it? Pin
Member 1241411416-Jun-16 22:32
Member 1241411416-Jun-16 22:32 
GeneralRe: I want to show my GPS cursor in Mapwingis, how to do it? Pin
Pete O'Hanlon16-Jun-16 22:37
mvePete O'Hanlon16-Jun-16 22:37 
GeneralRe: I want to show my GPS cursor in Mapwingis, how to do it? Pin
Member 1241411416-Jun-16 22:40
Member 1241411416-Jun-16 22:40 
GeneralRe: I want to show my GPS cursor in Mapwingis, how to do it? Pin
Pete O'Hanlon16-Jun-16 22:45
mvePete O'Hanlon16-Jun-16 22:45 
QuestionHow to find out, if the toolbar icon or the notifyicon is clicked Pin
Member 1191673515-Jun-16 19:26
Member 1191673515-Jun-16 19:26 
AnswerRe: How to find out, if the toolbar icon or the notifyicon is clicked Pin
OriginalGriff15-Jun-16 20:22
mveOriginalGriff15-Jun-16 20:22 
GeneralRe: How to find out, if the toolbar icon or the notifyicon is clicked Pin
Member 1191673515-Jun-16 22:50
Member 1191673515-Jun-16 22:50 
GeneralRe: How to find out, if the toolbar icon or the notifyicon is clicked Pin
OriginalGriff15-Jun-16 22:53
mveOriginalGriff15-Jun-16 22:53 
QuestionAccess Gmail contacts through C # Pin
Member 1253942914-Jun-16 14:42
Member 1253942914-Jun-16 14:42 
AnswerRe: Access Gmail contacts through C # Pin
BillWoodruff14-Jun-16 16:16
professionalBillWoodruff14-Jun-16 16:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.