R is a powerful programming language. Rstudio lets you use R
R can rearrange data, summarize data, and make awesome figures
R is free, R is your friend, be patient with R
R is a powerful programming language. Rstudio lets you use R
R can rearrange data, summarize data, and make awesome figures
R is free, R is your friend, be patient with R
| class | date | topic | class2 | date2 | topic2 |
|---|---|---|---|---|---|
| 1 | Nov 6th | orientation to Rstudio | 7 | Nov 27th | Plots 2 |
| 2 | Nov 7th | cleaning data | 8 | Nov 28th | Plots 3 |
| 3 | Nov 13th | Wrangling data | 9 | Dec 4th | Catch-up day |
| 4 | Nov 14th | Making tables | 10 | Dec 5th | Making reports |
| 5 | Nov 20th | Tables and Analyses | 11 | Dec 11th | Making reports 2 |
| 6 | Nov 21st | Plots 1 | 12 | Dec 12th | EXAMS / Wild Card |
#the # sign blanks out code
#You need to install.package only once, ever. Once installed your computer wont forget it
#that is why mine is blanked out with a # sign
#install.packages("tidyverse")
#install.packages("ggplot2")
#library() then tell your computer to remember the package you installed
#you will need to run this code everytime you start a new session
#there are 1000s of packages. tidyverse and ggplot2 are just two of the more useful common ones
library(tidyverse)
library(ggplot2)
?kable()
# <- R does not read code after the # sign
# setwd() tells r this is where your data is being stored on your computer
setwd("C:/Users/cyrus/OneDrive/Documents/R/input")
#read_csv brings in a csv file aka an excel spreadsheet
# the arrow sign assigns the excel spreadsheet to a name.
#In this case I name the excel file "data"
data <- read_csv("test_data.csv")
#take a peak at the first few rows head(data) #try customizing output with head(data, 10) #View the whole dataframe View(data) #take a peak at the last few rows tail(data) #check out the column names names(data)
#check the structure or type of data in a column. str(data$Total1) #for number or integer columns, check out some quick summary statistics summary(data$Total1) mean(data$`Patien's Age`) ?mean() mean(data$`Patien's Age`, na.rm = TRUE) #for categorical data, run table for a breakdown table(data$Gender) table(data$`Case Type`)
Many similar names. Next class we will learn how to change names
DONT PANIC !!!!
#you can put a question mark before any function and a help page pops up ?head()
Try a google search of the problem. Likely someone else asked a similar questions
Whatsapp or email the professor