Weeks 1-5 RStudio Commands Flashcards
To calculate the mean…
mean(sample_data)
To calculate the median…
median(sample_data)
To calculate the mode…
mode(sample_data)
To calculate standard deviation…
sd(sample_data)
Undo button
Ctrl + z
library(tidyverse)
Gives us useful tools for our analysis
cows <-read_csv(“~/penelope22.csv”)
Read spreadsheet called ‘penelope22’ into an object in R called ‘cows’ (basically renames spreadsheet for easy ref. later)
View(data)
Presents the data in a window in RStudio
What is a data frame?
2-dimmensional array of scores
Multiple columns in data set
When using a data frame, how do we specify which column we want to process?
State the code
(data$column)
How do we find the mean of a particular column in the data set?
data set name = cows
column name = estimate
mean(cows$estimate)
Tells Rstudio that missing data can be ignored…
na.rm = TRUE
Sometimes the data set can have missing values from the table.
How do we tell Rstudio to find the mean for a particular column that has missing values?
(data set name = cows)
(column = estimate)
mean(cows$estimate, na.rm = TRUE)
To create a histogram…
(data set name =sample_data)
hist(sample_data)
To create a histogram distribution for a particular column in the data set…
data set name = cows
column name = estimate
hist(cows$estimate)