knitr::opts_chunk$set(echo = TRUE)
rm(list=ls())
###Loads packages needed for the project.
library(dplyr)
Attaching package: 'dplyr'
The following objects are masked from 'package:stats':
filter, lag
The following objects are masked from 'package:base':
intersect, setdiff, setequal, union
library(ggplot2)
library(tidyr)
library(plotly)
Attaching package: 'plotly'
The following object is masked from 'package:ggplot2':
last_plot
The following object is masked from 'package:stats':
filter
The following object is masked from 'package:graphics':
layout
library(vegan)Loading required package: permute
library(readr)
###Imports the dataset into the code.
california_species_abundances_1_ <- read_csv("Downloads/california_species_abundances (1).csv")Rows: 85 Columns: 21
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (1): Species
dbl (20): Yosemite Valley, Big Sur Coast, Mojave Desert, Sierra Foothills, P...
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
View(california_species_abundances_1_)
###Changes variable california_species_abundances_1_ into shorter variable name for easier use throughout code. The matrix "my_data" is printed.
my_data <- california_species_abundances_1_
my_data# A tibble: 85 × 21
Species `Yosemite Valley` `Big Sur Coast` `Mojave Desert` `Sierra Foothills`
<chr> <dbl> <dbl> <dbl> <dbl>
1 Califor… 5 0 4 8
2 America… 8 9 0 9
3 Western… 6 2 4 7
4 Acorn W… 3 11 4 6
5 Red-tai… 4 3 7 0
6 Great E… 3 4 2 12
7 Snowy P… 2 10 8 10
8 Peregri… 7 12 3 1
9 Norther… 3 8 12 7
10 Western… 3 4 2 7
# ℹ 75 more rows
# ℹ 16 more variables: `Point Reyes` <dbl>, `Lake Tahoe` <dbl>,
# `Death Valley` <dbl>, `Santa Monica Mountains` <dbl>,
# `Channel Islands` <dbl>, `Central Valley Wetlands` <dbl>,
# `San Gabriel Mountains` <dbl>, `Anza-Borrego` <dbl>,
# `Redwood National Park` <dbl>, `Salton Sea` <dbl>,
# `Lassen Volcanic Park` <dbl>, `Elkhorn Slough` <dbl>, …