DH Tutorial: RS Studio

Xingyi Zhang
Sat, 12 Nov 2022 01:11:42 +0000
Week 9, Tutorial

This post will give a brief tutorial on RS Studio. It is a development environment for R, which is a programming language commonly used in statistics. As for Digital Arts & Humanities work, it helps with data cleaning, analysis, and graphing. Many open-sourced R packages are ready to use. In DH projects, this allows people to share their code easily and make the analysis (data cleaning) both transparent and reproducible. Since the software is free, there are also numerous tutorials on the internet. I will give a short example of loading data and creating a simple bar graph.

1. Login: you can download the desktop version here. Or, if you are a Carleton student, click here and log in with your college credentials.

2. You will see an initial screen like this. For this tutorial, you can use this data set to follow along. This dataset contains Sex, weight (kgs), and BMI for September and April, for 67 college freshmen. Download this dataset and upload it by clicking the button circled in red. Choose the file you just downloaded, and click ok. Alternatively (an easier way, is to load the data in the R script, which I will explain later).

upload dataset

3. The data will appear in the lower right corner. Click the button circled in red to create an R script file.

create R script

4. To directly load it, you can use the first line. Or use the second line if you uploaded it online. Type it in the R script you created

data <- read.csv("https://people.sc.fsu.edu/~jburkardt/data/csv/freshman_kgs.csv") data <- read.csv("freshman_kgs.csv")

load data

5. Some different commands you can try: mean, median, type it in the script and run it (note you need to select the lines to run it), you will be able to see the results on the upper right region.

6. We can also make simple histogram based on this. Type in

hist(data$BMI..Apr., breaks = 10)

different commands

R is much more powerful than what is shown here. There are many resources available for further studying of the software. Here are some: