Skip to contents

If you ever want to use R, there are a couple ways to access R: in the cloud or on your computer. If you want a cloud-based approach, utilize Posit.cloud. If you want it on your local computer1, you will need to install R and RStudio.

Posit.cloud

Posit.cloud is an online platform to run R. It is one of the resources provided by Posit. It is free to use, but there are some limitations. The advantage is that you only need a modern internet browser to access it. The disadvantage is that you cannot run intensive data analysis. Additionally, you should never upload any sensitive data. However, it is perfect for learning, because you will not need to worry about installing anything on your computer. To access Posit.cloud, use the following link: posit.cloud/. Use your Google account to create an account in Posit.

Using R

If you like to install R in your computer, please watch the video below:

install-R from Posit, Inc. on Vimeo.

RStudio

RStudio is an Integrated Development Environment (IDE) program used to make your life easier when you are programming in R. To use RStudio, you will need to install R first. While you can use R by itself, you don’t want to, trust me! You can think of R as an engine of a car, and RStudio as the model of a car. There are other IDE’s, but they are not as popular.

Additionally, RStudio provides numerous resources for new learners and data scientists. If you are interested in learning R and RStudio, I recommend you to look at Posit’s website for more information posit.co/.

Install RStudio (Optional)

To install RStudio on your computer, go to posit.co/download/rstudio-desktop/, and download the desktop free version to your system. Then install the software package on your computer. For more information, watch the video below.

Installing R Packages

If you are using RStudio, installing R packages is quite simple. Watch the video on install and use R packages.

Additional Requirements

Sometimes, you may want to install an R package, but it fails to install because you need additional software, c++. I personally use Linux, so I do not truly know what other OS’s need, but I will try my best to explain what other software you need to install the Rcpp package, one of the most commonly used package by other R packages. Most of this information is available here.

Windows

Once you install R, you will need to install Rtools. It will have the necessary cpp2 compiler to install Rcpp. Download Rtools 4.3 to be compatible for this package.

Mac

Once you install R, you may not be able to install packages with out some additional software. The best way to work around this problem is to install tidyverse:

install.packages("tidyverse")

Linux

If you follow the instructions here, you should already have a cpp compiler. However, you may need other code to install tidyverse or other R packages, via the terminal3:

# tidyverse
sudo apt install libcurl4-openssl-dev libfontconfig1-dev libharfbuzz-dev libfribidi-dev libfreetype6-dev libpng-dev libtiff5-dev libjpeg-dev


# lme4

sudo apt install cmake


# JMBayes

sudo apt install jags

# RStan

sudo apt install libv8-dev 

Installing csustats

You can install the package with the following code:

remotes::install_github("inqs909/csustats")

You may be prompted to update some of your current package. Unless you need to maintain certain package versions, I advise you to update all your packages. Press ‘1’ or the number indicating all packages. You will be prompted multiple time update your packages. Continue updating all packages until the installation is complete.