Ranae Dietzel & Andee Kaplan
Good to know for making simple examples
block = c("A", "B", "C", "A", "B", "C")
rep = c(1, 2, 1, 2, 1, 2)
mass = c(52, 48, 33, 32, 44, 49)
df = data.frame(block, rep, mass)
What have you done?
plot(df$mass ~ df$rep)
df$rep <- as.factor(df$rep)
plot(df$mass ~ df$rep)
If you get an error message, check your class!
Check your working directory. getwd()
Change your working directory. setwd()
Import your file
df <- read.table("file.txt", header = TRUE)
df <- readr::read_csv("file.csv")
For Excel files, look in to the readxl
package
%in% (?‘%in%’) (use quotes when looking up weird stuff)
==
when you have more than onedf[df$year %in% c(2008, 2009, 2010),]
| means “or”
df$ET[df$ET < 0 | df$ET > 10] <- NA
otherwise &
means “and”
[]
vs [[]]
[]
always gives you a list[[]]
gives you the content of the list