Showing posts with label Rstudio. Show all posts
Showing posts with label Rstudio. Show all posts

Wednesday, February 22, 2017

How do you fix this RStudio error?

You some times see this error in your RStudio console:

ERROR: [on_request_read] connection reset by peer

What is described is not a complete fix but a possible explanation of what is happening. It is most probably related to RStudio using the Microsoft Edge in Windows 10 operating system.

There are three modes that you can run to display in a viewer. This are shown in this image here:


ShinyError_000.png

Run in Window mode:

Run in Window opens a window ~ -Shiny as shown and runs the highlighted code to display the result.


ShinyError_00.PNG

Notice that the tab that is open is http://127.0.01:6170. Now if you change over the tab to 'Open in Browser', Microsoft Edge opens displaying the same URL. Now if you close the browser you see the error messages as shown. I am not sure why it repeats so many times.


ShinyError_02.PNG

However, if you copy the URL (http://127.0.0.1:6170) and paste it into a Firefox browser you will see 'Hello World' displayed again. But if you close this browser, no error is reported in RStudio console.

Hence in Run in Windows mode you can get away without producing error and stopping by pasting the code in Mozilla Firefox (assuming you want to see it in a browser).

Run External:

In this mode the Run result is displayed in the external browser which happens to be Microsoft Edge and you cannot avoid the error. Of course the code runs and displays the result but when you close the browser the error crops up in the console.

Run in Viewer Pane:

Viewer pane is one of the panes of RStudio. When you run the code in this mode the result will be displayed as shown.

The error crops up immediately as shown.


ShinyError_04.PNG

You need to click the Stop button to return to console prompt.

You can avoid this problem by choosing Mozilla Firefox as your default browser.


ShinyError_05.PNG

Tuesday, February 21, 2017

How do I download R Studio to run / learn R programming?

If you are looking for the free version you need to download the RStudio Desktop which comes under Open Source License. Go here to see other versions which are not free ).

In the above link choose the free edition which has Integrated Tools for R and click Download.

You get the following page. If your operating system is in this list, you download from the related link. Note that depending on whether or not you have R 2.11.1+ version. If you do not have you need to download that one first (http://cran.rstudio.com/).


RStudidowwnloads.png

Click on the one you need. For Windows 10 Desktop, the relevant installer is RStudio 1.0.136 -Windows Vista/7/8/10.

You save the file to your Downloads folder.

Double click the executable and it begins installing following the wizard steps.

The installation folder by default is C:\Program Files\RStudio but you can change. You can also add shortcuts.

The installation is quick and you will find the rstudio.exe in the RStudio\bin folder. Double click to launch the program. The shiny package is already in it as shown.


RStudio_01

When you just run library(shiny) in RStudio you get the following response. You also get color coding and code guidance very much like intellisense as shown.


RStudio_02