RStudio

R is a popular statistical analysis and machine-learning package that includes tests, models, analyses, and graphics, and enables data management. RStudio, included in IBM Watson Studio, provides an IDE for working with R.

Access RStudio

RStudio is now integrated in IBM Watson Studio projects and can be launched after you create a project.With RStudio integration in projects, you can access and use the data files that are stored in the IBM Cloud Object Storage bucket associated with your project in RStudio.

To start RStudio in your project, click RStudio from the Launch IDE menu on your project’s action bar.

A compute environment runtime is activated and the development environment opens.

Watch this video to see an overview of the RStudio IDE.

Figure 1. Video iconOverview of the RStudio IDE
This video provides an overview of the RStudio IDE.

RStudio environments

When you launch RStudio, a default RStudio environment runtime is automatically activated.

Currently, Watson Studio offers the following default RStudio environment:

  • Default RStudio XS
    1 vCPU and 5 GB RAM

Restrictions:

  • At this time, you can’t create your own RStudio environment definition. The Default RStudio XS environment definition is automatically used when RStudio is started.
  • The Default RStudio XS environment definition is not listed on the project’s Environments page. This means that you can’t view the environment definition details nor can you customize the environment definition. However, when you start RStudio, the runtime which is active for your session is listed on the Environments page. You can stop the runtime from this page.

File system

In RStudio, you can work with data files from different sources:

  • Files in the RStudio server file structure, which you can view by clicking Files in the bottom right section of RStudio. This is where you can create folders, upload files from your local system, and delete files.

    To access these files in R, you need to set the working directory to the directory with the data files. You can do this by navigating to the directory with the files and clicking More > Set as Working Directory.

    Be aware that files stored in the Home directory of your RStudio instance are persistent within your instance only and cannot be shared across environments nor within your project.

    Watch this video to see how to load data to RStudio.

    Figure 2. Video iconLoad data into RStudio
    This video shows you the different ways to load data into RStudio.
  • Data files that are stored in the IBM Cloud Object Storage bucket associated with your project. When RStudio is launched, the IBM Cloud Object Storage bucket content is mounted to your Home directory under the project-objectstorage folder. You are permitted to view the content of data files in this folder only. You can read and update data files in that folder, however you cannot delete files.

    Restriction: You cannot load files to this folder at this time.

    If new data assets are added to the project which you want to access from RStudio, you need to refresh the folder.

    See how to read and write data to and from Cloud Object Storage.

  • Data stored in a database system.

    Watch this video to see how to analyze Db2 Warehouse on Cloud data in RStudio.

    Figure 3. Video iconAnalyze Db2 Warehouse on Cloud data in RStudio
    This video shows you how to analyze Db2 Warehouse on Cloud data in RStudio.

Capacity consumption and runtime scope

An RStudio environment runtime is always scoped to an environment definition and a user. Only one RStudio runtime can be active per Watson Studio user at one time. If you started RStudio in another project, you are asked if you want to stop that runtime session and start a new RStudio session in the context of the current project you’re working in.

Runtime usage is calculated by the number of capacity unit hours (CUHs) consumed by the active environment runtime.

The CUHs consumed by an active RStudio runtime in a project are billed to the account that the project creator has selected in his or her profile settings at the time the project is created.

This table shows the capacity units per hour calculation for the default RStudio environment.

Environment type Capacity units per hour
1 vCPU and 5 GB RAM 0.50

You can see your active RStudio environment runtime on the project’s Environments page where you can track your runtime usage. You can stop the runtime from this page.

You can also track runtime usage for an account on the Environment Runtimes page from the Manage menu. All account admins can open the Environment Runtimes page for the account.

Remember: The CUH counter continues to increase while the runtime is active so stop the runtime if you aren’t using RStudio. If you don’t explicitly stop the runtime, it is stopped for you after an idle time of 2 hour. During this idle time, you will continue to consume CUHs for which you are billed. Long compute-intensive jobs are hard stopped after 24 hours.

You are notified when you’re about to reach the runtime capacity limit for your Watson Studio service plan. When this happens, you can upgrade your service plan. For up-to-date information, see the Watson Studio pricing plans.

Learn more