Posit Cloud, R and RStudio IDE

Registering and Accesing Posit Cloud and Installing R and RStudio

Author

Kamarul Imran Musa

Published

August 1, 2025

Posit Cloud

Posit Cloud lets you access Posit’s powerful set of data science tools right in your browser – no installation or complex configuration required.

Posit Cloud lets you access Posit’s powerful set of data science tools right in your browser–no installation or complex configuration required.

Get To Know Cloud

Do, share, teach and learn data science using the RStudio IDE or Jupyter Notebooks, directly from your browser. You can share projects with your team, class, workshop or the world. Teach or learn data science in R or Python with students or colleagues.

There’s nothing to install or maintain and no dedicated hardware or annual purchase contract is required. Individual users, instructors and students only need a browser - we handle everything else.

Register for free Posit Cloud account and access our course

Steps:

  • Click POSIT Cloud folder for our workshop at this link
  • Proceed with registration if required

Free registration
  • Join the space

Join the space
  • Go to Members area

Members area
  • Create new RStudio project

Create a new RStudio project
  • RStudio interface

RStudio interface

Personal Workspace

Personal workspace is your Workspace, which is your personal workspace on Posit Cloud.

Only you can work on content in Your Workspace, but you can choose to let content here be viewed (and copied) by other Posit Cloud users.

By default, any content you create can only be accessed by you. To share content with others, open the content, click on the settings button (the gear in the upper right) and change Access to Everyone.

You can also copy the content’s address from your browser and distribute the link however you wish.

Shared Spaces

You can also do work in a shared space on Posit Cloud. A shared space is an area where a group of people can collaborate together - only the members of a shared space can access the space and its content.

To learn more about shared spaces, please take a look at the Posit Cloud Guide.

R Programming Language

Introduction to R

R is a language and environment for statistical computing and graphics. It is a GNU project which is similar to the S language and environment which was developed at Bell Laboratories (formerly AT&T, now Lucent Technologies) by John Chambers and colleagues. R can be considered as a different implementation of S. There are some important differences, but much code written for S runs unaltered under R.

R provides a wide variety of statistical (linear and nonlinear modelling, classical statistical tests, time-series analysis, classification, clustering, …) and graphical techniques, and is highly extensible. The S language is often the vehicle of choice for research in statistical methodology, and R provides an Open Source route to participation in that activity.

One of R’s strengths is the ease with which well-designed publication-quality plots can be produced, including mathematical symbols and formulae where needed. Great care has been taken over the defaults for the minor design choices in graphics, but the user retains full control.

The R environment

R is an integrated suite of software facilities for data manipulation, calculation and graphical display. It includes

  • an effective data handling and storage facility,

  • a suite of operators for calculations on arrays, in particular matrices,

  • a large, coherent, integrated collection of intermediate tools for data analysis,

  • graphical facilities for data analysis and display either on-screen or on hardcopy, and

  • a well-developed, simple and effective programming language which includes conditionals, loops, user-defined recursive functions and input and output facilities.

The term “environment” is intended to characterize it as a fully planned and coherent system, rather than an incremental accretion of very specific and inflexible tools, as is frequently the case with other data analysis software.

There are some terms we have to be familiar:

  • packages
  • codes
  • parameters
  • argument

CRAN

CRAN (Comprehensive R Archive Network) is the primary repository for R packages, and it hosts thousands of packages that users can download and install to extend the functionality of the R Programming Language.

These packages are created by R users and developers from around the world and cover a wide range of topics and applications.

It functions as a robust repository, hosting a diverse collection of R packages and related software, making it an essential cornerstone for statisticians, data scientists, and researchers worldwide. In this comprehensive exploration, we will delve deep into the significance of CRAN and its pivotal role in nurturing the growth of the R programming language.

Understanding CRAN

  • CRAN is a network of servers storing R packages.

  • R is an open-source programming language for statistical computing.

  • The packages on CRAN enhance data analysis capabilities.

  • CRAN serves as the primary platform for sharing packages with the R community.

The Importance of CRAN

  1. Central Hub: CRAN acts as the central hub for R packages, a place where users can easily access, download, and install packages without the need for extensive searches across various websites or sources. This seamless access streamlines the process of enhancing R’s capabilities, enabling users to find and install packages effortlessly.

  2. Quality Assurance: One of CRAN’s standout features is its steadfast dedication to quality assurance. Package maintainers undergo rigorous review processes when submitting their packages to CRAN. This meticulous examination ensures that packages meet the highest standards, including thorough documentation, best practices, and adherence to CRAN’s guidelines. As a result, users can have full confidence in the quality and dependability of packages on CRAN.

  3. Version Management: CRAN maintains a comprehensive history of package versions, allowing users to access and install specific versions of packages. This feature is crucial for ensuring the reproducibility of data analysis and research, ensuring that code performs as intended, even as packages evolve over time.

  4. Diverse Selection of Packages: CRAN hosts a vast array of packages covering a wide range of domains. From statistical modeling and machine learning to data visualization and manipulation, CRAN’s repository caters to the needs of beginners and experienced users alike. Whatever your data analysis requirements, you’re likely to discover a package that streamlines and enhances your workflow on CRAN.

  5. Community Collaboration: Beyond being a distribution platform for packages, CRAN fosters a vibrant community of R developers, maintainers, and users. Developers can collaborate on packages, share their expertise, and contribute to the ongoing enrichment of R’s ecosystem. Users can seek help, report issues, and engage in discussions, fostering a sense of camaraderie and support that bolsters the entire community.

R Packages

R codes are contained with a package. CRAN provides the list of all R packages.

  • It is accessible at CRAN webpage
  • There at (of 10 July 2023) almost 20000 R packages listed on CRAN packages webpage
  • Look at CRAN TaskViews if you want to know R packages that are grouped based on certain topics such as Bayesian, Causal Inference, Epidemiology and many others.
  • There are also many more packages that are not listed on CRAN but hosted on other repositories such as GitHub.

Installing R Packages

If you need to use certain R packages, you have to install it first. There are two ways of installing R packages into your R IDE:

  • Writing codes in R Console: Type install.packages("tidyverse"), then click ENTER

Install R package
  • Using GUI in the Package pane

Install the R package

Now procedd to install these packages

  • tidyverse
  • haven
  • here
  • gtsummary

R functions

We have to write R scripts to perform desired task in R. R scripts consists a set of R codes. Users write R scrips in the Console pane or in R Script file or other R editor such as Quarto document.

Some simple codes as examples:

ChickWeight[1:20,]

lm(weight ~ Time, data = ChickWeight)

ChickWeight[1:20,]
   weight Time Chick Diet
1      42    0     1    1
2      51    2     1    1
3      59    4     1    1
4      64    6     1    1
5      76    8     1    1
6      93   10     1    1
7     106   12     1    1
8     125   14     1    1
9     149   16     1    1
10    171   18     1    1
11    199   20     1    1
12    205   21     1    1
13     40    0     2    1
14     49    2     2    1
15     58    4     2    1
16     72    6     2    1
17     84    8     2    1
18    103   10     2    1
19    122   12     2    1
20    138   14     2    1
lm(weight ~ Time, data = ChickWeight)

Call:
lm(formula = weight ~ Time, data = ChickWeight)

Coefficients:
(Intercept)         Time  
     27.467        8.803  

Arguments in R functions

Now, let’s type a question mark in front of a function.

For example, type a question mark infront of lm. Then click ENTER.

?lm

A window will appear. It will describe the detailed information about the function. You can see the default paramaters for such function, such as:

lm(formula, data, subset, weights, na.action, method = "qr", model = TRUE, x = FALSE, y = FALSE, qr = TRUE, singular.ok = TRUE, contrasts = NULL, offset, ...)

You will see arguments for each parameters:

  • formula
  • data
  • subsets
  • weight

and others

RStudio IDE

RStudio is an integrated development environment (IDE) for R and Python. It includes a console, syntax-highlighting editor that supports direct code execution, and tools for plotting, history, debugging, and workspace management. RStudio is available in open source and commercial editions and runs on the desktop (Windows, Mac, and Linux).

There are a few ways to use RStudio:

  • Install it on your computer
  • Use it on the Cloud (POSIT, Amazon, Microsoft, Saturn Cloud)
  • Install and use it on a server (RStudio Workbench)

To use RStudio IDE, you need to install R first.

Installing R

Installing R on Windows

  1. Visit the CRAN Website: Go to the Comprehensive R Archive Network (CRAN) homepage.

  2. Download R for Windows: Click on “Download R for Windows,” then select “base” and click “Download R 4.x.x for Windows” to get the latest version.

  3. Run the Installer: Locate the downloaded .exe file and double-click it to launch the installer.

  4. Follow Installation Prompts:

  • Choose your preferred language.
  • Accept the license agreement.
  • Select installation path (default is fine).
  • Choose components (default selections are usually sufficient).
  • Complete the installation.
  1. Verify Installation: Open the R GUI from your Start Menu or search bar. You should see the R console ready for use.

Installing R on macOS

  1. Visit the CRAN macOS Page: Head to the CRAN macOS download section.

  2. Choose the Correct Installer:

  • For Apple Silicon (M1/M2): Download R-4.5.1-arm64.pkg
  • For Intel Macs: Download R-4.5.1-x86_64.pkg
  1. Run the Installer Package: Double-click the .pkg file to begin installation.

  2. Follow On-Screen Instructions:

  • Agree to the license.
  • Choose installation location.
  • Authenticate with your Mac password if prompted.
  1. Optional: Install XQuartz: If you plan to use packages that rely on X11 (like tcltk), install XQuartz before running R.

  2. Launch R: Find the R application in your Applications folder and open it to start coding.

Installing RStudio IDE

Installing RStudio IDE on Windows

  1. Download RStudio Installer: Visit the RStudio download page and click “Download RStudio Desktop” under the Open Source Edition.

  2. Choose the Windows Version: Select the installer for Windows (usually named something like RStudio-2025.x.x.exe).

  3. Run the Installer:

  • Double-click the .exe file.
  • Follow the setup wizard: accept the license, choose installation location, and proceed with default settings.
  1. Launch RStudio: After installation, search for “RStudio” in the Start Menu and open it. It should detect your R installation automatically.

Installing RStudio IDE on macOS

  1. Download RStudio for macOS: Go to the RStudio download page and click “Download RStudio Desktop” for macOS.

  2. Choose the Correct Installer: For macOS 11+ (Intel or Apple Silicon), download the .dmg file appropriate for your architecture.

  3. Install RStudio

  • Open the .dmg file.
  • Drag the RStudio icon into your Applications folder.
  1. Launch RStudio: Open RStudio from the Applications folder. It should automatically detect your R installation.

  2. (Optional) Install Rosetta 2: If you’re using an Apple Silicon Mac and RStudio prompts you, install Rosetta 2 by running this in Terminal:

  /usr/sbin/softwareupdate --install-rosetta 

Hands on with RStudio IDE

Prepare the R environment

Steps:

  • Create a new RStudio project
  • Load required R libraries
library(tidyverse) #data wrangling and data visualization
library(gtsummary) #to perform EDA

Reflection

  • Could you access our course?
  • What do you think would be your main challenges in running R and RStudio?
  • Are you interested to run R on your machine?
  • How would you get help if stuck with analysis?
  • Have you tried generative AI such as chatGPT?
  • What is an R package?
  • What is an R code?
  • What is a function?
  • What contains in a function?