6 Replies Latest reply on Mar 16, 2019 4:34 PM by Attila B

    Set up Rserve on Windows

    Sean MacRae

      I'm excited about R functionality in Tableau 8.1 but am having a challenge setting up the Rserve connection. Any help?

        • 1. Re: Set up Rserve on Windows
          Matt Lutton

          Have you looked at this:

          Impact Analytix: Business Intelligence, Predictive Analytics & Excel

           

          I believe this blog entry should cover most of what you need.

          1 of 1 people found this helpful
          • 2. Re: Set up Rserve on Windows
            Sean MacRae

            I started there. I followed the link to Rserve and downloaded the most recent install. I have several versions of R and R Studio installed on my machine, but the Rserve executable could not install (error: R.dll is missing).

             

            I then read that you can install Rserve directly from CRAN, so I installed from CRAN in R Studio (successfully) but don't really know what to do from there.

             

            When I attempt to configure the R connection in Tableau it asks for a username and profile (I'm assuming assigned by Rserve). How do I generate that? Or am I approaching this all wrong?

            1 of 1 people found this helpful
            • 3. Re: Set up Rserve on Windows
              Matt Lutton

              I know nothing on the topic, I just happened to see the blog post earlier today.  Sorry I cannot be of any more help--perhaps you can contact the blog author for some insight?

              1 of 1 people found this helpful
              • 4. Re: Set up Rserve on Windows
                Jeffrey Shaffer

                Starting from the beginning for anyone that is trying to do this.  Here's the R code.

                 

                # install Rserve package

                install.packages("Rserve")

                # load the Rserve package

                library(Rserve)

                # Starts Rserve

                Rserve(debug = FALSE, args = NULL, quote=(length(args) > 1))

                 

                The Console window should display:

                Starting Rserve... "c:\gsutil\R\WIN-LI~1\3.0\Rserve\libs\x64\Rserve.exe"

                 

                In Tableau, under the Help menu select "Manage R Connection..."

                Select "localhost" under the Server with the default port of 6311 and then select "Test Connection" (leave the box unchecked for "Sign in with user name and password").

                 

                You should get a dialog box that says "Successfully connected to the Rserve service".

                 

                I am using R version 3.0.1.  you can use this command in RStudio to check your version.

                getRversion()

                 

                Hope this helps.

                2 of 2 people found this helpful
                • 5. Re: Set up Rserve on Windows
                  Nicholas Boeke

                  this worked for me despite being on 64bit R v2.15.3 (others said I'd have troubles with Rserve having 32bit binary, but those were old posts, mostly referencing 8.1 beta)

                   

                  Thanks Jeffrey!

                  1 of 1 people found this helpful
                  • 6. Re: Set up Rserve on Windows
                    Attila B

                    I know its an old question, but as I had real pain figuring out setting up Rserve / FastRWeb under Windows, I thought a future googler may find it useful to find this.

                     

                    - Install R and install packages Rserve, FastRweb, Cairo, Matrix and XML from CRAN, if not already installed.

                    - In some configurations, installation folder for packages is not the R root (which is usually C:\Program Files\R\{Rversion}), but somewhere else (like Documents/R/win-library\{R version}. This is important to note.

                    - Copy Rserve.dll, Rserve.exe and Rserve_d exe from {package directory}\Rserve\libs\x64 to {R root}\bin\x64

                    - Rename Rserve.conf in {package directory}\FastRWeb\code to Rserv.cfg. In Windows, Rserve looks for it with this name.

                    - Edit Rserv.cfg to get rid of the pre-set Unix socket connection information and add the Windows entries. Make sure to delete those lines with socket and sockmod settings and have the following lines instead:

                     

                    http.port [arbitrary port] #if unsure, the default 3611 works

                    http.raw.body enable

                    plaintext enable #as the Windows environment doesn't support encryption without tweaking

                    control assent

                     

                    - Create a cmd file in any text editor. Save it where you want with any name you want as long as the extension is cmd. The following lines are essential:

                     

                    SET ROOT = {package directory}/FastRweb #note the forward slash

                    R CMD Rserve_d.exe --RS-conf {package directory}\FastRWeb\code\Rserv.cfg #note the backslash

                     

                    - Edit Rserve.R. Seek the line root <- Sys.getenv("ROOT"). Add these lines after it:

                     

                    options(FastRweb.root = root)

                    .http.request <- FastRWeb:::.http.request

                     

                    With the above lines, you tell Rserve to rely on FastRweb for http requests for R scripts and you prevent Rserve to fall back on the Unix /var root syntax.

                     

                    - Start Rserve through your cmd file. Rserve and FastRWeb are up and running and waiting for your browser to send R requests. You may test it with localhost:3611/main.

                     

                    - Your custom R codes are to be saved to {package directory}\FastRWeb\web.R.

                     

                    I hope it helps.