{
  "id": 146680,
  "title": "R in Python Notebook",
  "url": "/competitions/march-madness-analytics-2020/discussion/146680",
  "author_name": "Michaël Karpe",
  "post_date": "2020-04-28T05:18:53.125000",
  "votes": 1,
  "comment_count": 2,
  "views": 0,
  "content": "<p>Hi all,</p>\n\n<p>I'd like to run R code in a Python notebook (my team mostly worked in Python but we have also some R code). I tried to do it with <code>pip install rpy2</code> and <code>%load_ext rpy2.ipython</code> but when I execute <code>pip install rpy2</code> I get the error on the image below:</p>\n\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F1609504%2Fd5b1ef2f52f43ade8db9a898237f993f%2Fr-python-kernel.png?generation=1588050754447904&amp;alt=media\" alt=\"\"></p>\n\n<p>Is there a way to install R in a Python notebook to run then R code with rpy2, or is there another way to run R code in a Python kernel?</p>\n\n<p>If there is no way to run R code in a Python notebook, is it possible to add some commented R code and upload the output image of the corresponding code in a notebook for this competition?</p>\n\n<p>Thanks for your answers!</p>",
  "messages": [
    {
      "id": 824015,
      "postDate": "2020-04-28T05:18:53.127Z",
      "content": "<p>Hi all,</p>\n\n<p>I'd like to run R code in a Python notebook (my team mostly worked in Python but we have also some R code). I tried to do it with <code>pip install rpy2</code> and <code>%load_ext rpy2.ipython</code> but when I execute <code>pip install rpy2</code> I get the error on the image below:</p>\n\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F1609504%2Fd5b1ef2f52f43ade8db9a898237f993f%2Fr-python-kernel.png?generation=1588050754447904&amp;alt=media\" alt=\"\"></p>\n\n<p>Is there a way to install R in a Python notebook to run then R code with rpy2, or is there another way to run R code in a Python kernel?</p>\n\n<p>If there is no way to run R code in a Python notebook, is it possible to add some commented R code and upload the output image of the corresponding code in a notebook for this competition?</p>\n\n<p>Thanks for your answers!</p>",
      "rawMarkdown": "Hi all,\n\nI'd like to run R code in a Python notebook (my team mostly worked in Python but we have also some R code). I tried to do it with `pip install rpy2` and `%load_ext rpy2.ipython` but when I execute `pip install rpy2` I get the error on the image below:\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F1609504%2Fd5b1ef2f52f43ade8db9a898237f993f%2Fr-python-kernel.png?generation=1588050754447904&amp;alt=media)\n\nIs there a way to install R in a Python notebook to run then R code with rpy2, or is there another way to run R code in a Python kernel?\n\nIf there is no way to run R code in a Python notebook, is it possible to add some commented R code and upload the output image of the corresponding code in a notebook for this competition?\n\nThanks for your answers!",
      "votes": 1
    },
    {
      "id": 1107730,
      "postDate": "2020-12-09T23:08:04.383Z",
      "content": "<p>Hi, that worked for me:</p>\n<p>!pip install rpy2 <br>\n%load_ext rmagic<br>\n%load_ext rpy2.ipython<br>\n%%R <br>\n(and write your command)</p>",
      "rawMarkdown": "Hi, that worked for me:\n\n!pip install rpy2 \n%load_ext rmagic\n%load_ext rpy2.ipython\n%%R \n(and write your command)"
    },
    {
      "id": 828296,
      "postDate": "2020-04-30T22:02:51.703Z",
      "rawMarkdown": "",
      "isDeleted": true
    }
  ],
  "comments": [
    {
      "id": 1107730,
      "author_name": "Gustav C",
      "author_url": "",
      "post_date": "2020-12-09T23:08:04.383000",
      "content": "<p>Hi, that worked for me:</p>\n<p>!pip install rpy2 <br>\n%load_ext rmagic<br>\n%load_ext rpy2.ipython<br>\n%%R <br>\n(and write your command)</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 828296,
      "author_name": "",
      "author_url": "",
      "post_date": "2020-04-30T22:02:51.703000",
      "content": "",
      "votes": 0,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "824015": "Hi all,\n\nI'd like to run R code in a Python notebook (my team mostly worked in Python but we have also some R code). I tried to do it with `pip install rpy2` and `%load_ext rpy2.ipython` but when I execute `pip install rpy2` I get the error on the image below:\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F1609504%2Fd5b1ef2f52f43ade8db9a898237f993f%2Fr-python-kernel.png?generation=1588050754447904&amp;alt=media)\n\nIs there a way to install R in a Python notebook to run then R code with rpy2, or is there another way to run R code in a Python kernel?\n\nIf there is no way to run R code in a Python notebook, is it possible to add some commented R code and upload the output image of the corresponding code in a notebook for this competition?\n\nThanks for your answers!",
    "1107730": "Hi, that worked for me:\n\n!pip install rpy2 \n%load_ext rmagic\n%load_ext rpy2.ipython\n%%R \n(and write your command)",
    "828296": ""
  }
}