Vectors

sites <- c("a", "a", "b", "b")
density_ha <- c(2.8, 3.2, 1.5, 3.8)
mean(density_ha)
max(density_ha)
min(density_ha)
sum(density_ha)
density_ha <- c(2.8, 3.2, 1.5, 3.8)
area_ha <- c(3, 5, 1.9, 2.7)
total_number <- density_ha * area_ha

Do Exercise 9 - Shrub Volume Vectors.

Matrices (if linear algebra folks)

x <- matrix(1:6, 2)
y <- matrix(1:3, ncol = 1)
x %*% y

Data frames

surveys <- data.frame(sites, density_ha, area_ha)

Importing data

When someone says setwd discuss issues

  • Code doesn’t work on different computers
  • Even worse if collaborating with several people Ask if anyone has heard of projects

Projects

shrub_data <- read.csv('./data/shrub-dimensions-labeled.csv')

DO NOT USE setwd() FOR THIS CLASS

Do Exercise 10 - Shrub Volume Data Frame.

Project structure

Assign remaining exercises.