Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to know (or specify) the localhost port used by R shiny (when running in local)

I would like to know what port R shiny will use to display the app. I can see on some forums that the port should be 8100, but when I run the app, the chosen posrt changes every time R is restarted.

Is there any way to specify this port? Or at least to know the port that will be used, to use it in another part of the script?

like image 521
Instanton Avatar asked Jun 24 '14 13:06

Instanton


People also ask

What port does Shiny server run on?

The server running on port 3838 defines two locations. The first is at the URL /users , which makes user applications available using the user_dirs hosting model, as documented in the Host Per-User Application Directories section of the Shiny Server Administrator's guide.

Can you run Shiny app locally?

You might be eager to deploy your Shiny app to a remote server. But the simplest way to run a Shiny app is to run it locally. You only need the shiny R package installed, and you can run the app in your browser. In this post you'll see a few ways of how to organize your files to be served locally.

How do I run a localhost on a different port?

Open C:\xampp\apache\conf, find the httpd. conf file and open with notepad++. Look for these lines and change 80 in the last line any other port, for example 8080. This way we will be able to run Apache but the http://localhost/url won't work for that you need to append port number into the URL.

How do I run a Shiny code in R?

Open the app. R script in your RStudio editor. RStudio will recognize the Shiny script and provide a Run App button (at the top of the editor). Either click this button to launch your app or use the keyboard shortcut: Command+Shift+Enter (Control+Shift+Enter on Windows).


1 Answers

There is a port= parameter you can specify to runApp. The default value is NULL which chooses a random port. Read the ?runApp help page for more information.

like image 63
MrFlick Avatar answered Sep 18 '22 11:09

MrFlick