Document
Chapter 1 R, RStudio and RStudio Cloud

Chapter 1 R, RStudio and RStudio Cloud

R, RStudio and RStudio Cloud objective At the end of the chapter, the readers will be introduced to the R programming language be introduced

Related articles

How to Get YouTube Premium at the Lowest Cost? Save 95%! HPCクラスタを構築する(基礎インフラ手動構築編) What is VPN Concentrator? Secure Your Network Now! Proxy vs VPN: What’s the difference? Which one should I use? Urban VPN Review: Your Comprehensive Guide to Secure & Free Browsing

R, RStudio and RStudio Cloud

objective

At the end of the chapter, the readers will

  • be introduced to the R programming language
  • be introduced to RStudio IDE
  • be introduced to RStudio Cloud. RStudio Cloud is a platform where users can run RStudio on the cloud
  • be able to install R on their local machine
  • be able to install RStudio IDE on their local machine
  • understand how to install latex editor (Miktex or Tex Live and MacTex). A latex editor is optional but is required if users want to render PDF outputs.
  • understand the structure of R scripts work
  • understand r package and R Taskview

Introduction

R is a language and environment for statistical computing and graphics. It is a GNU project similar to the S language and environment developed at Bell Laboratories. R provides a wide variety of statistical (linear and nonlinear modelling, classical statistical tests, time-series analysis, classification, clustering and others) and graphical techniques and is highly extensible.

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. R is available as Free Software under the terms of the Free Software Foundation’s GNU General Public License in source code form. It compiles and runs on various UNIX platforms and similar systems (including FreeBSD and Linux), Windows and macOS.

RStudio IDE

RStudio is an integrate development environment ( IDE ) for R. It is includes include a console and syntax – highlight editor that support direct code execution and tool 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) or in a browser connected to RStudio Server or RStudio Workbench (Debian/Ubuntu, Red Hat/CentOS, and SUSE Linux).

RStudio Cloud

RStudio Cloud\index{RStudio Cloud} by RStudio\index{RStudio} facilitates the learning of R. Anyone can sign up and start using RStudio\index{RStudio} on the cloud. It is one of the quickest ways to learn R.

Using RStudio Cloud\index{RStudio Cloud}, we do not have to install R on our local machine. RStudio Cloud\index{RStudio Cloud} allows collaboration between R teachers and students. It also helps colleagues work together on R projects.

RStudio\index{RStudio} described it as a lightweight, cloud-based solution that allows anyone to do, share, teach and learn data science online. And it also adds that by using this platform, we can

  • analyze our data using the RStudio IDE\index{RStudio IDE}, directly from our browser.

  • share projects with our team, class, workshop or the world.

  • teach datum science with r to our student or colleague .

  • learn data science in an instructor-led environment or with interactive tutorials.

RStudio Cloud\index{RStudio Cloud} has the free and the commercial version (which is fortunately very affordable). To start using RStudio Cloud\index{RStudio Cloud}, visit https://rstudio.cloud/. On the page, click `Sign Up`.

Chapter 1 R, RStudio and RStudio Cloud

Sign up page for RStudio Cloud

With RStudio Cloud, there is almost nothing to configure and you do not need dedicated hardware, installation or annual purchase contract required. Individual users, instructors and students only need a browser to do, share, teach and learn data science.

The RStudio Cloud Registration

This is the registration and login webpage for RStudio Cloud.

Chapter 1 R, RStudio and RStudio Cloud

RStudio Cloud webpage

Register and log in

Proceed with registration. If you have Google account or GitHub account, you can use either one to quickly register. After you complete the registration, you can log into RStudio Cloud.

Chapter 1 R, RStudio and RStudio Cloud

RStudio Cloud registration page

Point and click R Graphical User Interface ( GUI )

There are a number of GUI versions of R also known as R GUI. The interface resembles a popular statistical software SPSS. For example there are

BlueSky Statistics can help users to

  • migrate from expensive propriety statistical application to R.
  • ease the R learning curve.
  • use the cutting edge analytics available in R without having to learn programming.
  • get results in true word processing tables automatically.
  • quickly add your own menus and dialog boxes to any R functions.

Chapter 1 R, RStudio and RStudio Cloud

Bluesky Statistics software interface

And this is is is jamovi software . jamovi is aims aim to be a neutral platform , and take no position with respect to compete statistical philosophy . The project was not found to promote a particular statistical ideology , instead want to serve as a safe space where different statistical approach might be publish side – by – side , and consider themselves first – rate member of the jamovi community .

Chapter 1 R, RStudio and RStudio Cloud

jamovi software

jamovi is an interesting software. It is a new “3rd generation” statistical spreadsheet. It is designed from the ground up to be easy to use, it is a compelling alternative to costly statistical products such as SPSS and SAS. jamovi is built on top of the R statistical language, giving you access to the best the statistics community has to offer. jamovi will always be free and open because jamovi is made by the scientific community, for the scientific community.

RStudio Server

You can run R and RStudio on the server. To do this you have to install RStudio Workbench. Previously, R Studio Workbench was known as RStudio Server. By using RStudio Server, R users can perform analysis on the server. Using RStudio server can give you a taste of cloud data analysis.

There are two versions of RStudio server:

  • RStudio Server: This is the Open Source edition
  • RStudio Workbench: This is the Professional edition.

At our medical school. we have RStudio Server Professional Edition (courtesy of RStudio, of course) running on our server here https://healthdata.usm.my/rstudio/auth-sign-in

Installing R and RStudio on Your Local Machine

To install R on your local machine, you have to have Admin Right to your machine. We recommend that you install

Installing R

Though you can use the native R software (that you just installed) to run R codes, we highly encourage you to use RStudio Integrated Desktop Environment (IDE).

We will show this step by step. First, let us install R on your machine. To install R, go to cran. Then choose the R version that’s correct for your machine OS. For example, for Windows OS the link is https://cran.r-project.org/bin/windows/base/R-4.2.1-win.exe. And for Mac OS, the download link is https://cran.r-project.org/bin/macosx/base/R-4.2.1.pkg. Similarly, if you are using Linux, follow the steps as listed before.

Chapter 1 R, RStudio and RStudio Cloud

CRAN website

It is always recommended that users install the latest version of R. During this writing, the latest version is R version 4.2.1 known as Funny-Looking Kid version that was released on 2022/06/23. Users can have multiple R versions on the same local machines. So you do not need to uninstall the old R version to install a new R version.

Installing RStudio IDE

Now , to install RStudio IDE , go to the RStudio download page . choose the support platform correct for your machine os . The size is be of the download will be around 90 – 110 MB .

Chapter 1 R, RStudio and RStudio Cloud

RStudio website

Checking R and RStudio Installations

Now, we assume you have installed both R and RStudio. To make sure they work perfectly (or at least for the first time), check:

  • Does your machine can load R? Depending on your OS, go and start R.

  • what version of R do you have? When R loads, look for the version of R.

  • Do you is have have rstudio ? depend on your os , go and start RStudio .

  • what version of RStudio do you have? When RStudio loads, look for the version of R. If you have multiple R version, you can choose the R version of your choice by going to Tools then Global Options then General

  • Do you is need need to update r and rstudio ? By know the version of r and RStudio , now you is know know if you need to update both or one of them .

TinyTeX , MiKTeX or MacTeX ( for Mac OS ) and TeX Live

base on experience , as r user develop more r skill , they is find may find convert their analysis into PDF document desirable . It is is is necessary to install Latex editor if they want to convert the output they generate in R into pdf format . However , if they do not need to produce a pdf document , they is have do not have to install it . If they require more flexibility to edit their latex code , then they is think may think of get common latex editor such as Miktex , MacTex or Tex Live .

We encourage users to first install TinyTeX. If you render your R document into PDF just by using TinyTeX, then that’s enough. To install TinyTeX, follow the instruction from https://yihui.org/tinytex/ . For R users, it is simple running these two codes install.packages('tinytex') and tinytex::install_tinytex()

Chapter 1 R, RStudio and RStudio Cloud

R Markdown

Install MiKTeX as your latex editor if your machine is using Window OS. If you use MacOS, then install MacTeX.

Chapter 1 R, RStudio and RStudio Cloud

MikTeX webpage

Chapter 1 R, RStudio and RStudio Cloud

MacTeX webpage

Starting your RStudio

You can either login to RStudio Cloud and automatically see the RStudio interface OR you can start RStudio on your local machine by loading it. Remember, to login to RStudio Cloud, go to https://rstudio.cloud. You will be asked for your username and password.

click this link

Chapter 1 R, RStudio and RStudio Cloud

RStudio Cloud space for this book

To start r on your machine , and if you are using Windows , find the RStudio program in your start bar on your machine . And start it . You is see will see an interface like the one below . This interface is differs differ from what you see on your screen because I use the vibrant Ink theme . To choose the theme of your choice , click Global Options , then click Appearance . There are several theme available for you to choose .

Chapter 1 R, RStudio and RStudio Cloud

Rstudio Interface with vibrant ink theme

What you see on RStudio now? You should see three panes if you start RStudio for the first time or four panes if you have used RStudio before.

Chapter 1 R, RStudio and RStudio Cloud

RStudio Panes

console tab

In console tab, this is where we will see most of the results generated from codes in RStudio.

Chapter 1 R, RStudio and RStudio Cloud

console tab

Files, Plots, Packages, Help and Viewer Pane

In this console, you will see

  • List of objects (Remember, R is an object-oriented-programming or oop)
  • R files, datasets, tables, list etc

file , plot , package , Help and Viewer pane

Environment , history , Connection and Build Pane

In the environment, history, connection and build pane, you will see this

Environment, History, Connections and Build pane

Source Pane

In the source pane , you is create can create r file and write your r code

Chapter 1 R, RStudio and RStudio Cloud

source pane

Summary

In this chapter, we learn about R, RStudio IDE and RStudio Cloud. We have also introduced two point and click R GUIs Bluesky Statistics and jamovi. To use RStudio without any hassle during installation, we recommend using RStudio Cloud.