Package 'quadcleanR'

Title: Cleanup and Visualization of Quadrat Data
Description: A tool that can be customized to aid in the clean up of ecological data collected using quadrats and can crop quadrats to ensure comparability between quadrats collected under different methodologies.
Authors: Dominique Maucieri [aut, cre]
Maintainer: Dominique Maucieri <[email protected]>
License: GPL (>= 3)
Version: 1.1.1.9000
Built: 2025-02-21 04:47:20 UTC
Source: https://github.com/dominiquemaucieri/quadcleanr

Help Index


Add data to existing data frame.

Description

Using key identifying columns, add additional columns to an existing data frame. This function allows you to match new columns based on specified IDs and you can choose what columns to add. Additionally you can specify the column number at which to add the new columns, so they are not added to the end of the data frame. Helpful for adding environmental or taxonomic data to your quadrat data.

Usage

add_data(data, add, cols, data_id, add_id, number = FALSE)

Arguments

data

A data frame you want to add columns to.

add

A data frame with columns you want to add to data.

cols

The column names from add that you wish to add to data.

data_id

The ID column in data that will be used to match rows in add.

add_id

The ID column in add that will be used to match rows in data.

number

The column number to start at to add the new columns, so they are not added to the end of the data frame. If not specified they will be added to the end of the data frame by default.

Value

A data frame with added columns.

Examples

Sites <- as.factor(c("One", "One", "One", "Two", "Two", "Three"))
Transect <- as.factor(c("1-Deep", "1-Shallow", "2-Shallow", "1-Shallow", "1-Deep", "1"))
coral_name <- c("Acropora.sp", "Leptastrea.sp", "Sinularia.sp", "Psammocora.sp", "
    Psammocora.sp", "Leptastrea.sp")
prop_cover <- c(0.1, 0.6, 0.4, 0.9, 0.2, 0.5)
coral_cover <- data.frame(Sites, Transect, coral_name, prop_cover)

corals <- c("Acropora.sp", "Leptastrea.sp", "Psammocora.sp")
lifehistory <- c("compeditive", "weedy",  "stresstolerant")
functionalgroup <- c("hardcoral", "hardcoral", "hardcoral")
coral_info <- data.frame(corals, lifehistory, functionalgroup)

add_data(data = coral_cover, add = coral_info, cols = c("lifehistory", "functionalgroup"),
         data_id = "coral_name", add_id = "corals", number = 4)

Categorize data based on contents of a column

Description

Using a column within the data frame, categorize rows in a binary of yes or no, or customize with a set of category names. Data can be categorized based on the inclusion or lack of inclusion of parts of characters, or based on exact characters. Especially useful for turning ID tags into useful categories for analysis such as morphology, bleaching, taxonomy etc.

Usage

categorize(data, column, values, name, binary = TRUE, exact = TRUE, categories)

Arguments

data

The data frame.

column

The column name which contains the data on which to categorize rows.

values

The characters or parts of characters to use to classify rows.

name

The name of the now column of categories.

binary

If binary = TRUE, the name column will be returned with "Yes" denoting that characters ,or parts of characters specified by values are present in the row, while "No" denotes that there are no characters or parts of characters specified in values present in the row. If binary = FALSE there must be categories provided which will be used to classify the presence of characters or parts of characters specified in values.

exact

If exact = TRUE only exact matches will be selected. If exact = FALSE matches will be selected if they contain the characters in the values vector and will not be limited by exact matches.

categories

The factor names denoting the presence of the characters or parts of characters specified by values. These must be specified in the same order as the corresponding element in values.

Value

A data frame with new categorization column.

Examples

Sites <- as.factor(c("One", "One", "One", "Two", "Two", "Three"))
Transect <- as.factor(c("1-Deep", "1-Shallow", "2-Shallow", "1-Shallow", "1-Deep", "1-Deep"))
Acropora.sp <- c(0.1, 0.6, 0.4, 0.9, 0.2, 0.5)
Gardineroseris.sp <- c(0.4, 0.9, 0.5, 0.23, 0.5, NA)
Psammocora.sp <- c(0.9, 0.6, 0.5, 0.8, 0.1, 0.4)
Leptastrea.sp <- c(0.5, 0.7, 0.4, 0.8, 0.2, NA)
Notes <- c(NA, NA, "saw octopus", NA, "white balance corrected", NA)
coral_cover <- data.frame(Sites, Transect, Acropora.sp, Gardineroseris.sp,
                          Psammocora.sp, Leptastrea.sp, Notes)

# Classify shallow transects in a binary column
categorize(data = coral_cover, column = "Transect", values = "Shallow",
    name = "Shallow", binary = TRUE, exact = FALSE)

# Classify depth of transect in a new column based on transect name
categorize(data = coral_cover, column = "Transect", values = c("Shallow", "Deep"),
    name = "Depth", binary = FALSE, categories = c("S", "D"), exact = FALSE)

Change names of columns

Description

Using a new data frame of labels, change column names in one function. Helpful if column names are shorthands or contain spaces and characters that are not supported in column names in R.

Usage

change_names(data, labelset, from, to)

Arguments

data

The data frame that you want to change the column names of.

labelset

The data frame containing column names that you want to change and what you want them to be changed to.

from

The name of the column in the label set data frame containing the original column names.

to

The name of the column in the label set data frame containing new column names that the original column names will be changed to.

Value

A data frame containing new column names.

Examples

#creating data set
Sites <- c("One", "Two", "Three", "Four", "Five")
Acrop <- c(0.1, 0.4, 0.9, 0.2, 0.5)
Gardin <- c(0.4, 0.9, 0.5, 0.23, 0.8)
Psam <- c(0.9, 0.5, 0.8, 0.1, 0.4)
Lepta <- c(0.5, 0.7, 0.8, 0.2, 0.9)
coral_cover <- data.frame(Sites, Acrop, Gardin, Psam, Lepta)

#creating label data frame
species_short <- c("Acrop", "Gardin", "Psam", "Lepta")
species_long <- c("Acropora", "Gardineroseris", "Psammocora", "Leptastrea")
coral_labels <- data.frame(species_short, species_long)

change_names(coral_cover, coral_labels, "species_short", "species_long")

Change values within a column

Description

Using two vectors, change the values in one column to a new set of values. Helpful if you need to change many values at once, like updating changes to site names or taxonomy.

Usage

change_values(data, column, from, to)

Arguments

data

A data frame.

column

The column in which to change values.

from

A vector containing the values you wish to change.

to

A vector contain the values you want to change to, ensuring these occur in the same order as the from vector.

Value

A data frame containing new values within the specified column.

Examples

Sites <- c("One.jpg", "Two.jpg", "Three.jpg", "Four.jpg", "Five.jpg")
Dominant_Coral <- c("Acropora.sp", "Leptastrea.spp", "Acropora.sp",
                    "Acropora.sp", "Acropora.sp")
Dominant_Cover <- c(0.1, 0.4, 0.9, 0.2, 0.5)
Largest_Coral <- c("Acropora.sp", "Acropora.sp", "Psammocora.sp",
                   "Acropora.sp","Gardineroseris.spp")

coral_cover <- data.frame(Sites, Dominant_Coral, Dominant_Cover, Largest_Coral)

change_values(coral_cover, "Dominant_Coral",
    c("Acropora.sp","Leptastrea.spp"), c("Acropora_tabulate", "Leptastrea.purpurea"))

Labelset for Corals

Description

A data_frame that can be used with the Simple Cleaning Quadrat Data vignette to rename columns in quadrat data and add functional group data, to produce easy to analyze data frames. The short names were used to identify substrate using CoralNet and are included in the output from CoralNet.

Usage

coral_labelset

Format

A data_frame with 5 columns, which are:

short_name

The short name ID used to annotate the photo quadrats.

full_name

The long name and definition for each short name ID.

taxonomic_name

The taxonomic grouping name for each short name ID.

functional_group

The functional group for each ID.

life_history

The life history category for each coral ID.


Simple Coral Quadrat Data

Description

A data_frame that can be used with the Simple Examples of Functions vignette to learn how the cleaning functions in quadcleanR work. Data was collected by the Baum Lab and Kiritimati Field Teams. Data is the uncleaned version of data found in Maucieri and Baum 2021. Biological Conservation. doi:10.1016/j.biocon.2021.109328 The data are from photo quadrats (1m by 1m) which were randomly annotated with 100 random points each. At each of these annotated points, the substrate was identified. Photo quadrats were collected on Kiritimati Island in the Republic of Kiribati and document coral cover over time and space. The annotations and output of the data_frame were produced using CoralNet and all annotations were done manually, by trained researchers.

Usage

corals

Format

A data_frame with 14 columns, which are:

Field.Season

Field season ID.

Site

Site number.

Quadrat

Quadrat ID.

AcCor

Percent of total annotated points annotated for Acropora (corymbose morphology).

AcDig

Percent of total annotated points annotated for Acropora (digitate morphology).

AcroTab

Percent of total annotated points annotated for Acropora (tabulate morphology).

Monta

Percent of total annotated points annotated for Montastraea.

Lepta

Percent of total annotated points annotated for Leptastrea.

Sinu

Percent of total annotated points annotated for Sinularia.

Clad

Percent of total annotated points annotated for Cladiella.

Lobph

Percent of total annotated points annotated for Lobophora.

Sarco

Percent of total annotated points annotated for Sarcophyton.

Unc

Percent of total annotated points annotated for unclear.

SHAD

Percent of total annotated points annotated for shadow.


Calculate species cover

Description

Convert the number of observations for each species or non-species to proportion or percent cover within each row based on the total number of observations in each row. Useful for quadrats with varying numbers of observations to calculate each row's percent cover all at once.

Usage

cover_calc(data, spp, prop = TRUE, total = FALSE)

Arguments

data

A data frame with each row representing a sampling unit (ex. a quadrat or photo).

spp

The column names containing all observations to be used in the proportion calculation. It is important to note that the proportions will be scaled to the total observations in these columns for each quadrat.

prop

If prop = TRUE, the resulting cover will be proportions. If prop = FALSE, the resulting cover will be in percentages.

total

If total = TRUE, a column containing the total number of observations at each sampling unit will be returned in a new column called total_pts. This will not be returned if total = FALSE.

Value

A data frame containing scaled observation cover.

Examples

#create data set for example
Sites <- as.factor(c("One", "One", "Two", "Two", "Three", "Three"))
Transect <- as.factor(c("1-Shallow", "2-Shallow", "1-Shallow", "2-Shallow",
    "1-Shallow", "2-Shallow"))
Acropora.sp <- c(1, 2, 3, 4, 5, 6)
Gardineroseris.sp <- c(6, 1, 2, 3, 4, 5)
Psammocora.sp <- c(5, 6, 1, 2, 3, 4)
Leptastrea.sp <- c(4, 5, 6, 1, 2, 3)
coral_cover <- data.frame(Sites, Transect, Acropora.sp, Gardineroseris.sp,
                          Psammocora.sp, Leptastrea.sp)

cover_calc(data = coral_cover, spp = names(coral_cover[3:6]), prop = TRUE, total = TRUE)

cover_calc(data = coral_cover, spp = names(coral_cover[3:6]), prop = FALSE, total = FALSE)

Crop quadrats based on area

Description

Using the location of annotated points within quadrats and the size of the quadrat, crop quadrat data to a smaller area, while maintaining the spatial relationships between points. Useful for making different sized quadrat data comparable.

Usage

crop_area(
  data,
  row,
  column,
  id,
  dim,
  obs_rm = FALSE,
  obs_range,
  res = FALSE,
  res_dim_x,
  res_dim_y
)

Arguments

data

A data frame containing annotations, in long format, such that all observations are contained in one column.

row

The column name in data which contains the row locations of the annotated points.

column

The column name in data which contains the column location of the annotated points.

id

The column name in data which contains the quadrat ID for the annotated points.

dim

A vector with length of 2, containing the proportion of the row and columns to crop. First element will be the proportion of the rows and the second will be the proportion of the columns.

obs_rm

If obs_rm = FALSE, no quadrats will be removed from the returned data set. If obs_rm = TRUE, quadrats will be removed from the returned data set based on the number of annotated observations in the cropped area as specified by obs_range.

obs_range

A vector with length of 2, specifying the min and max accepted number of annotated observations to retain in the data set.

res

If res = TRUE if the dimensions of each quadrat are known. These must be the same units as the row and column locations. If dimensions are not known, specify res = FALSE, and the function will estimate the max dimensions based off the max row and column location for the annotated points.

res_dim_x

The column name in data which contains the max column dimension for each quadrat.

res_dim_y

The column name in data which contains the max row dimension for each quadrat.

Value

A data frame in of quadrat annotations with a subset of annotated points.

Examples

#Creating the data file
tags <- c("Clad", "Sinu", "Sarco", "Loph")

site <- c(rep("Site1", times = 100),
         rep("Site2", times = 100),
         rep("Site3", times = 100),
         rep("Site4", times = 100))
row <- c(sample(x = c(1:2000), size = 100, replace = TRUE),
        sample(x = c(1:2000), size = 100, replace = TRUE),
        sample(x = c(1:2000), size = 100, replace = TRUE),
        sample(x = c(1:2000), size = 100, replace = TRUE))
column <- c(sample(x = c(1:2000), size = 100, replace = TRUE),
           sample(x = c(1:2000), size = 100, replace = TRUE),
           sample(x = c(1:2000), size = 100, replace = TRUE),
           sample(x = c(1:2000), size = 100, replace = TRUE))
label <- c(sample(x = tags, size = 100, replace = TRUE),
          sample(x = tags, size = 100, replace = TRUE),
          sample(x = tags, size = 100, replace = TRUE),
          sample(x = tags, size = 100, replace = TRUE))
coral_annotations <- data.frame(site, row, column, label)

crop_area_coral <- crop_area(data = coral_annotations, row = "row",
                            column = "column", id = "site", dim = c(0.5, 0.5))

coral_annotations$col_dim <- 2000
coral_annotations$row_dim <- 2000

crop_area_coral_2 <- crop_area(data = coral_annotations, row = "row",
                              column = "column", id = "site", dim = c(0.5, 0.5),
                              res = TRUE, res_dim_x = "col_dim", res_dim_y = "row_dim")

Sample Environmental Data for Cleaning Vignettes

Description

A data_frame that can be used with the Simple Cleaning Quadrat Data vignette to show how environmental data can be easily added to quadrat data. Data was collected and collated by the Baum Lab. Data was originally published with coral quadrat data in Maucieri and Baum 2021. Biological Conservation doi:10.1016/j.biocon.2021.109328.

Usage

environmental_data

Format

A data_frame with 7 columns, which are:

Site

Site number.

HD_Cat

Estimate of local human disturbance at each site as a categorical variable.

HD_Cont

Estimate of local human disturbance at each site as a continuous variable.

NPP

Max net primary productivity at each site (mg C m^-2 day^-1).

WE

If the sampling site is on the sheltered or windward side of the atoll.

Region

Region of the atoll.

WaveEnergy

Wave energy at each site (kW m^-1).


Final cleaned quadrat data

Description

A data_frame that was created with the Cleaning Quadrat Data from CoralNet. This is an example data frame of how the quadcleanR package can be useful in cleaning quadrat data.

Usage

final_cleaned

Format

A data_frame with 14 columns, which are:

Field.Season

Field season ID.

TimeBlock

If the sampling season was before, during or after the El Niño event.

Site

Site number.

Quadrat

Quadrat ID.

HD_Cat

Estimate of local human disturbance at each site as a categorical variable.

HD_Cont

Estimate of local human disturbance at each site as a continuous variable.

NPP

Max net primary productivity at each site (mg C m^-2 day^-1).

WE

If the sampling site is on the sheltered or windward side of the atoll.

Region

Region of the atoll.

WaveEnergy

Wave energy at each site (kW m^-1).

Taxonomic_Name

Taxonomic name for each substrate.

functional_group

Functional group for each substrate.

life_history

Life history classification for each substrate.

prop_cover

The proportion cover for each substrate.


Keep or remove rows and columns from data frame

Description

Using a character, or part of character select rows or columns of the data frame to either keep or remove. A more customizable way to subset your data as you can keep or remove based on partial matches, or cells containing select characters.

Usage

keep_rm(
  data,
  values,
  select,
  keep = TRUE,
  drop_levels = TRUE,
  exact = TRUE,
  colname
)

Arguments

data

A data frame.

values

A vector containing the characters or parts of characters to base selection off of.

select

If select = "row", rows containing the values will be selected for either being kept, or being removed, as specified by keep. If select = "col", columns with names containing the values will either be kept or removed, as specified by keep.

keep

If keep = TRUE the presence of the values will cause the selected rows or columns to be kept. If keep = FALSE the presence of the values will cause the selected rows or columns to be removed.

drop_levels

If drop_levels = TRUE, factor levels that have been removed will be dropped. Only applicable when select = "row"

exact

If exact = TRUE only exact matches will be selected. If exact = FALSE matches will be selected if they contain the characters in the values vector and will not be limited to exact matches only.

colname

If select = "row", colname will specify the column to select rows from.

Value

A data frame containing new selection of data.

Examples

# create data frame
Sites <- as.factor(c("One", "One", "One", "Two", "Two", "Three"))
Transect <- as.factor(c("1-Deep", "1-Shallow", "2-Shallow", "1-Shallow", "1-Deep", "1-Deep"))
Acropora.sp <- c(0.1, 0.6, 0.4, 0.9, 0.2, 0.5)
Gardineroseris.sp <- c(0.4, 0.9, 0.5, 0.23, 0.5, NA)
Psammocora.sp <- c(0.9, 0.6, 0.5, 0.8, 0.1, 0.4)
Leptastrea.sp <- c(0.5, 0.7, 0.4, 0.8, 0.2, NA)
Notes <- c(NA, NA, "saw octopus", NA, "white balance corrected", NA)
coral_cover <- data.frame(Sites, Transect, Acropora.sp, Gardineroseris.sp,
                         Psammocora.sp, Leptastrea.sp, Notes)

#Removing Notes column
keep_rm(data = coral_cover, values = c("Notes") , select = "col",
   keep = FALSE, drop_levels = FALSE, exact = TRUE)

#Selecting site One and dropping extra levels
Site_One <- keep_rm(data = coral_cover, values = c("One") , select = "row",
   keep = TRUE, drop_levels = TRUE, exact = TRUE, "Sites")
levels(Site_One$Sites)

#Removing Deep sites
Shallow_Sites <- keep_rm(data = coral_cover, values = c("-Shallow") , select ="row",
   keep = FALSE, drop_levels = TRUE, exact = FALSE, "Transect")

#Selecting only species data
Species <- keep_rm(data = coral_cover, values = c(".sp") , select ="col",
   keep = TRUE, drop_levels = TRUE, exact = FALSE)

Remove characters from data frame

Description

Parts of characters can be removed based on a vector of removal characters. When these characters are present in the data frame they will be removed. Selection area can include the full data frame or a subset of columns. When working with images, this can be helpful to remove extra characters from image IDs, or anywhere else where you want to remove specific characters from your data.

Usage

rm_chr(data, rm, full_selection = TRUE, cols)

Arguments

data

A data frame.

rm

The parts of characters to be removed from the data frame. Can be a single element or a vector of elements.

full_selection

If full_selection = TRUE parts of characters matching the rm argument will be removed from entire data frame. If full_selection = FALSE only the specified columns will have the parts of characters matching the rm argument removed.

cols

If full_selection = FALSE this argument will specify which columns to have characters matching the rm argument removed.

Value

A data frame containing the selected parts of characters removed.

Examples

# creating data set
Sites <- c("One.jpg", "Two.jpg", "Three.jpg", "Four.jpg", "Five.jpg")
Dominant_Coral <- c("Acropora.sp", "Leptastrea.spp", "Acropora.sp",
    "Acropora.sp", "Acropora.sp")
Dominant_Cover <- c(0.1, 0.4, 0.9, 0.2, 0.5)
Largest_Coral <- c("Acropora.sp", "Acropora.sp", "Psammocora.sp",
    "Acropora.sp","Gardineroseris.spp")

coral_cover <- data.frame(Sites, Dominant_Coral, Dominant_Cover, Largest_Coral)

# removing a character from select columns
coral_cover_nospp <- rm_chr(coral_cover, c(".spp"), full_selection = FALSE,
    cols = c("Largest_Coral", "Dominant_Coral"))

# removing multiple characters from all columns
coral_cover_clean <- rm_chr(coral_cover, c(".jpg", ".spp", ".sp"))

Calculate sample sizes

Description

Specify which columns to use to produce a table with sample sizes. Helpful to visualize number of samples in your data.

Usage

sample_size(data, dim_1, dim_2, count)

Arguments

data

The data frame you want to calculate sample sizes for.

dim_1

The first dimension to calculate sample sizes for. This will be the resulting row names. This must be the column name within data.

dim_2

The second dimension to calculate sample sizes for. This will be the resulting column names. This must be the column name within data.

count

The column name within data that you wish to count the length of in order to calculate the sample sizes.

Value

A data frame of sample sizes.

Examples

Year <- c("2000", "2000", "2000", "2000", "2000", "2001", "2001", "2001", "2001",
"2002", "2002", "2002", "2002", "2003", "2003", "2003", "2003", "2003", "2003")
Site <- c("site1", "site1", "site2", "site2", "site2","site1", "site1", "site2",
          "site2", "site1", "site1", "site2", "site2","site1", "site1", "site2",
          "site2", "site2", "site2")
Quadrat <- c("Q1", "Q2", "Q3", "Q4", "Q5", "Q6", "Q7", "Q8", "Q9", "Q10", "Q11",
             "Q12", "Q13", "Q14", "Q15", "Q16", "Q17", "Q18", "Q19")
Cover <- sample(x = seq(from = 0, to = 1, by = 0.01), 19, replace = TRUE)
coral_cover <- data.frame(Year, Site, Quadrat, Cover)

sample_size(coral_cover, dim_1 = "Site", dim_2 = "Year", count = "Quadrat")

Sample Annotation Data for Cropping Vignette

Description

A data_frame that can be used with the Why to Crop Quadrats by Area vignette to show how quadrat data can be cropped while maintaining spatial relationships between observations. Data was collected by the Baum Lab and Kiritimati Field Teams. Data is the uncleaned version of data found in Maucieri and Baum 2021. Biological Conservation. doi:10.1016/j.biocon.2021.109328 The data are from photo quadrats (1m by 1m) which were randomly annotated with 100 random points each. At each of these annotated points, the substrate was identified. Photo quadrats were collected on Kiritimati Island in the Republic of Kiribati and document coral cover over time and space. The annotations and output of the data_frame were produced using CoralNet and all annotations were done manually, by trained researchers.

Usage

softcoral_annotations

Format

A data_frame with 4 columns, which are:

Name

Unique identification code for each quadrat.

Row

The pixel row where the annotation occurred in the photo of the quadrat.

Column

The pixel column where the annotation occurred in the photo of the quadrat.

Label

The identification for the substrate below the annotation location.


Sample Quadrat Data (1m by 1m)

Description

A data_frame that can be used with the cleaning vignette to show how quadrat data can be cleaned to produce easy to analyze data frames. Data was collected by the Baum Lab and Kiritimati Field Teams. Data is the uncleaned version of data found in Maucieri and Baum 2021. Biological Conservation. doi:10.1016/j.biocon.2021.109328 The data are from photo quadrats (1m by 1m) which were randomly annotated with 100 random points each. At each of these annotated points, the substrate was identified. Photo quadrats were collected on Kiritimati Island in the Republic of Kiribati and document coral cover over time and space. The annotations and output of the data_frame were produced using CoralNet and all annotations were done manually, by trained researchers.

Usage

softcoral_LQuads

Format

A data_frame with 135 columns, which are:

Image.ID

Photo quadrat image ID from CoralNet.

Image.name

The photo quadrat image name.

Annotation.status

If the quadrat has been completely annotated, or if there are more annotations to occur.

Points

The total number of annotation points in the quadrat.

AcCor

Percent of total annotated points annotated for Acropora (corymbose morphology).

AcDig

Percent of total annotated points annotated for Acropora (digitate morphology).

Acr_arb

Percent of total annotated points annotated for Acropora (arborescent morphology).

Acrop

Percent of total annotated points annotated for Acropora.

AcroTab

Percent of total annotated points annotated for Acropora (tabulate morphology).

Astreo

Percent of total annotated points annotated for Astreopora.

B_Acr_arb

Percent of total annotated points annotated for bleached Acropora (arborescent morphology)

B_Acro

Percent of total annotated points annotated for bleached Acropora.

B_Astre

Percent of total annotated points annotated for bleached Astreopora.

BAT

Percent of total annotated points annotated for bleached Acropora (tabulate morphology).

B_Cosc

Percent of total annotated points annotated for bleached Coscinarea.

B_Echin

Percent of total annotated points annotated for bleached Echinophyllia.

B_FavHal

Percent of total annotated points annotated for bleached Favites halicora.

B_Favia

Percent of total annotated points annotated for bleached_Favia.

B_FaviaM

Percent of total annotated points annotated for bleached Favia matthaii.

B_FaviaS

Percent of total annotated points annotated for bleached Favia speciosa.

B_FaviaSt

Percent of total annotated points annotated for bleached Goniastrea stelligera.

B_Favites

Percent of total annotated points annotated for bleached Favites.

B_FavPent

Percent of total annotated points annotated for bleached Favites pentagona.

B_Fung

Percent of total annotated points annotated for bleached Fungia.

BGard

Percent of total annotated points annotated for bleached Gardineroseris.

B_GonEd

Percent of total annotated points annotated for bleached Goniastrea edwardsi.

B_Herpo

Percent of total annotated points annotated for bleached Herpolitha.

B_HYDNO

Percent of total annotated points annotated for bleached Hydnophora.

B_HyExe

Percent of total annotated points annotated for bleached Hydnophora exesa.

BlAcro-Cor

Percent of total annotated points annotated for bleached Acropora (corymbose morphology).

B_Lepta

Percent of total annotated points annotated for bleached Leptastrea.

B_Lepto

Percent of total annotated points annotated for bleached Leptoseris.

Blisop

Percent of total annotated points annotated for bleached Isopora.

B_Lobo

Percent of total annotated points annotated for bleached Lobophyllia.

BlTurbFol

Percent of total annotated points annotated for bleached Turbinaria (foliose morphology).

B_MOEN

Percent of total annotated points annotated for bleached Montipora (encrusting morphology).

B_MOFO

Percent of total annotated points annotated for bleached Montipora (foliose morphology).

B_Monta

Percent of total annotated points annotated for bleached Montastraea.

B_Monti

Percent of total annotated points annotated for bleached Montipora.

B_Oxyp

Percent of total annotated points annotated for bleached Oxypora.

B_Paly

Percent of total annotated points annotated for bleached Palythoa.

B_PaveDUER

Percent of total annotated points annotated for bleached Pavona duerdeni.

B_Pavona

Percent of total annotated points annotated for bleached Pavona.

B_PEYDO

Percent of total annotated points annotated for bleached Pocillopora eydouxi.

B_Plat

Percent of total annotated points annotated for bleached Platygyra.

B_PMEAN

Percent of total annotated points annotated for bleached Pocillopora meandrina.

B_Pocillo

Percent of total annotated points annotated for bleached Pocillopora.

B_Porit

Percent of total annotated points annotated for bleached Porites.

B_Psam

Percent of total annotated points annotated for bleached Psammocora.

B_PVAR

Percent of total annotated points annotated for bleached Pavona varians.

B_Sando

Percent of total annotated points annotated for bleached Sandolitha.

B_UnkCoral

Percent of total annotated points annotated for bleached unknown hard coral.

Cirr

Percent of total annotated points annotated for Cirrhipathes.

COSC

Percent of total annotated points annotated for Coscinaraea.

ECHIN

Percent of total annotated points annotated for Echinophyllia.

Fav

Percent of total annotated points annotated for Favites.

FavHal

Percent of total annotated points annotated for Favites halicora.

Favites halicora

Percent of total annotated points annotated for Favia.

FaviaM

Percent of total annotated points annotated for Dipsastraea matthaii.

FaviaS

Percent of total annotated points annotated for Favia speciosa.

FaviaSt

Percent of total annotated points annotated for Favia stelligera.

FavPent

Percent of total annotated points annotated for Favites pentagona.

Fung

Percent of total annotated points annotated for Fungia.

Gardin

Percent of total annotated points annotated for Gardineroseris.

GonEd

Percent of total annotated points annotated for Goniastrea edwardsi.

Herpo

Percent of total annotated points annotated for Herpolitha.

HYDNO

Percent of total annotated points annotated for Hydnophora.

HyExe

Percent of total annotated points annotated for Hydnophora exesa.

Isopora

Percent of total annotated points annotated for Isopora.

Lepta

Percent of total annotated points annotated for Leptastrea.

Lepto

Percent of total annotated points annotated for Leptoseris.

Lobo

Percent of total annotated points annotated for Lobophyllia.

*MOEN

Percent of total annotated points annotated for Montipora (encrusting morphology).

*MOFO

Percent of total annotated points annotated for Montipora (foliose morphology).

Monta

Percent of total annotated points annotated for Montastraea.

Monti

Percent of total annotated points annotated for Montipora.

Oxyp

Percent of total annotated points annotated for Oxypora.

Paly

Percent of total annotated points annotated for Palythoa.

PaveDUER

Percent of total annotated points annotated for Pavona duerdeni.

Pavon

Percent of total annotated points annotated for Pavona.

PEYDO

Percent of total annotated points annotated for Pocillopora eydouxi.

Plat

Percent of total annotated points annotated for Platygyra.

Plero

Percent of total annotated points annotated for Plerogyra.

PMEAN

Percent of total annotated points annotated for Pocillopora meandrina.

Pocill

Percent of total annotated points annotated for Pocillopora.

Porit

Percent of total annotated points annotated for Porites.

Psam

Percent of total annotated points annotated for Psammocora.

PVAR

Percent of total annotated points annotated for Pavona varians.

Sando

Percent of total annotated points annotated for Sandolitha.

Tuba

Percent of total annotated points annotated for Tubastrea.

TURB

Percent of total annotated points annotated for Turbinaria.

UnkCoral

Percent of total annotated points annotated for unknown hard coral.

ANEM

Percent of total annotated points annotated for sea anemone.

B_Clad

Percent of total annotated points annotated for bleached Cladiella.

B_Sinu

Percent of total annotated points annotated for bleached Sinularia.

Clad

Percent of total annotated points annotated for Cladiella.

EncBry

Percent of total annotated points annotated for encrusting Bryozoan.

EUR

Percent of total annotated points annotated for sea urchin.

HYDCO

Percent of total annotated points annotated for Hydrocoral.

Hydra

Percent of total annotated points annotated for Hydroid.

Mille

Percent of total annotated points annotated for Millepora.

MOBI

Percent of total annotated points annotated for bivalves.

Sarco

Percent of total annotated points annotated for Sarcophyton.

SECO

Percent of total annotated points annotated for sea cucumber.

Sinu

Percent of total annotated points annotated for Sinularia.

Sponge

Percent of total annotated points annotated for sponge.

Stylas

Percent of total annotated points annotated for Stylaster.

UnkTUN

Percent of total annotated points annotated for unknown Tunicate.

XmasW

Percent of total annotated points annotated for Christmas Tree Worm.

ZOAN

Percent of total annotated points annotated for Zoanthid.

B_Sarco

Percent of total annotated points annotated for bleached Sarcophyton.

Sand

Percent of total annotated points annotated for sand.

Sediment

Percent of total annotated points annotated for sediment.

SCRO

Percent of total annotated points annotated for consolidated rock.

B_Loph

Percent of total annotated points annotated for bleached Lobophytum.

CYAN

Percent of total annotated points annotated for Cyanobacteria films.

Loph

Percent of total annotated points annotated for Lobophytum.

Rubble

Percent of total annotated points annotated for broken coral rubble.

SHAD

Percent of total annotated points annotated for shadow.

Trans

Percent of total annotated points annotated for transect hardware.

Unc

Percent of total annotated points annotated for unclear.

AVRA

Percent of total annotated points annotated for Avrainvillea.

Caul

Percent of total annotated points annotated for Caulerpa.

CCA

Percent of total annotated points annotated for crustose coraline algae.

Dict

Percent of total annotated points annotated for Dictyota.

DICTY

Percent of total annotated points annotated for Dictyosphaeria.

Hali

Percent of total annotated points annotated for Halimeda.

Lobph

Percent of total annotated points annotated for Lobophora.

Macro

Percent of total annotated points annotated for macroalgae.

Mdict

Percent of total annotated points annotated for Microdictyon.

Pad

Percent of total annotated points annotated for Padina.

Peysson

Percent of total annotated points annotated for Peyssonnelia.

Turf

Percent of total annotated points annotated for turf algae.

TURFH

Percent of total annotated points annotated for turf algae on hard substrate.

Unidentified

Percent of total annotated points annotated that were unidentified.


Sample Quadrat Data (0.6m by 0.9m)

Description

A data_frame that can be used with the Simple Cleaning Quadrat Data and the Cleaning and Cropping Quadrat Data vignettes to show how quadrat data can be cleaned to produce easy to analyze data frames. Data was collected by the Baum Lab and Kiritimati Field Teams. Data is the uncleaned version of data found in Maucieri and Baum 2021. Biological Conservation. doi:10.1016/j.biocon.2021.109328 The data are from photo quadrats (0.9m by 0.6m) which were randomly annotated with 54 random points each. At each of these annotated points, the substrate was identified. Photo quadrats were collected on Kiritimati Island in the Republic of Kiribati and document coral cover over time and space. The annotations and output of the data_frame were produced using CoralNet and all annotations were done manually, by trained researchers.

Usage

softcoral_SQuads

Format

A data_frame with 135 columns, which are:

Image.ID

Photo quadrat image ID from CoralNet.

Image.name

The photo quadrat image name.

Annotation.status

If the quadrat has been completely annotated, or if there are more annotations to occur.

Points

The total number of annotation points in the quadrat.

AcCor

Percent of total annotated points annotated for Acropora (corymbose morphology).

AcDig

Percent of total annotated points annotated for Acropora (digitate morphology).

Acr_arb

Percent of total annotated points annotated for Acropora (arborescent morphology).

Acrop

Percent of total annotated points annotated for Acropora.

AcroTab

Percent of total annotated points annotated for Acropora (tabulate morphology).

Astreo

Percent of total annotated points annotated for Astreopora.

B_Acr_arb

Percent of total annotated points annotated for bleached Acropora (arborescent morphology).

B_Acro

Percent of total annotated points annotated for bleached Acropora.

B_Astre

Percent of total annotated points annotated for bleached Astreopora.

BAT

Percent of total annotated points annotated for bleached Acropora (tabulate morphology).

B_Cosc

Percent of total annotated points annotated for bleached Coscinarea.

B_Echin

Percent of total annotated points annotated for bleached Echinophyllia.

B_FavHal

Percent of total annotated points annotated for bleached Favites halicora.

B_Favia

Percent of total annotated points annotated for bleached_Favia.

B_FaviaM

Percent of total annotated points annotated for bleached Favia matthaii.

B_FaviaS

Percent of total annotated points annotated for bleached Favia speciosa.

B_FaviaSt

Percent of total annotated points annotated for bleached Goniastrea stelligera.

B_Favites

Percent of total annotated points annotated for bleached Favites.

B_FavPent

Percent of total annotated points annotated for bleached Favites pentagona.

B_Fung

Percent of total annotated points annotated for bleached Fungia.

BGard

Percent of total annotated points annotated for bleached Gardineroseris.

B_GonEd

Percent of total annotated points annotated for bleached Goniastrea edwardsi.

B_Herpo

Percent of total annotated points annotated for bleached Herpolitha.

B_HYDNO

Percent of total annotated points annotated for bleached Hydnophora.

B_HyExe

Percent of total annotated points annotated for bleached Hydnophora exesa.

BlAcro-Cor

Percent of total annotated points annotated for bleached Acropora (corymbose morphology).

B_Lepta

Percent of total annotated points annotated for bleached Leptastrea.

B_Lepto

Percent of total annotated points annotated for bleached Leptoseris.

Blisop

Percent of total annotated points annotated for bleached Isopora.

B_Lobo

Percent of total annotated points annotated for bleached Lobophyllia.

BlTurbFol

Percent of total annotated points annotated for bleached Turbinaria (foliose morphology).

B_MOEN

Percent of total annotated points annotated for bleached Montipora (encrusting morphology).

B_MOFO

Percent of total annotated points annotated for bleached Montipora (foliose morphology).

B_Monta

Percent of total annotated points annotated for bleached Montastraea.

B_Monti

Percent of total annotated points annotated for bleached Montipora.

B_Oxyp

Percent of total annotated points annotated for bleached Oxypora.

B_Paly

Percent of total annotated points annotated for bleached Palythoa.

B_PaveDUER

Percent of total annotated points annotated for bleached Pavona duerdeni.

B_Pavona

Percent of total annotated points annotated for bleached Pavona.

B_PEYDO

Percent of total annotated points annotated for bleached Pocillopora eydouxi.

B_Plat

Percent of total annotated points annotated for bleached Platygyra.

B_PMEAN

Percent of total annotated points annotated for bleached Pocillopora meandrina.

B_Pocillo

Percent of total annotated points annotated for bleached Pocillopora.

B_Porit

Percent of total annotated points annotated for bleached Porites.

B_Psam

Percent of total annotated points annotated for bleached Psammocora.

B_PVAR

Percent of total annotated points annotated for bleached Pavona varians.

B_Sando

Percent of total annotated points annotated for bleached Sandolitha.

B_UnkCoral

Percent of total annotated points annotated for bleached unknown hard coral.

Cirr

Percent of total annotated points annotated for Cirrhipathes.

COSC

Percent of total annotated points annotated for Coscinaraea.

ECHIN

Percent of total annotated points annotated for Echinophyllia.

Fav

Percent of total annotated points annotated for Favites.

FavHal

Percent of total annotated points annotated for Favites halicora.

Favites halicora

Percent of total annotated points annotated for Favia.

FaviaM

Percent of total annotated points annotated for Dipsastraea matthaii.

FaviaS

Percent of total annotated points annotated for Favia speciosa.

FaviaSt

Percent of total annotated points annotated for Favia stelligera.

FavPent

Percent of total annotated points annotated for Favites pentagona.

Fung

Percent of total annotated points annotated for Fungia.

Gardin

Percent of total annotated points annotated for Gardineroseris.

GonEd

Percent of total annotated points annotated for Goniastrea edwardsi.

Herpo

Percent of total annotated points annotated for Herpolitha.

HYDNO

Percent of total annotated points annotated for Hydnophora.

HyExe

Percent of total annotated points annotated for Hydnophora exesa.

Isopora

Percent of total annotated points annotated for Isopora.

Lepta

Percent of total annotated points annotated for Leptastrea.

Lepto

Percent of total annotated points annotated for Leptoseris.

Lobo

Percent of total annotated points annotated for Lobophyllia.

*MOEN

Percent of total annotated points annotated for Montipora (encrusting morphology).

*MOFO

Percent of total annotated points annotated for Montipora (foliose morphology).

Monta

Percent of total annotated points annotated for Montastraea.

Monti

Percent of total annotated points annotated for Montipora.

Oxyp

Percent of total annotated points annotated for Oxypora.

Paly

Percent of total annotated points annotated for Palythoa.

PaveDUER

Percent of total annotated points annotated for Pavona duerdeni.

Pavon

Percent of total annotated points annotated for Pavona.

PEYDO

Percent of total annotated points annotated for Pocillopora eydouxi.

Plat

Percent of total annotated points annotated for Platygyra.

Plero

Percent of total annotated points annotated for Plerogyra.

PMEAN

Percent of total annotated points annotated for Pocillopora meandrina.

Pocill

Percent of total annotated points annotated for Pocillopora.

Porit

Percent of total annotated points annotated for Porites.

Psam

Percent of total annotated points annotated for Psammocora.

PVAR

Percent of total annotated points annotated for Pavona varians.

Sando

Percent of total annotated points annotated for Sandolitha.

Tuba

Percent of total annotated points annotated for Tubastrea.

TURB

Percent of total annotated points annotated for Turbinaria.

UnkCoral

Percent of total annotated points annotated for unknown hard coral.

ANEM

Percent of total annotated points annotated for sea anemone.

B_Clad

Percent of total annotated points annotated for bleached Cladiella.

B_Sinu

Percent of total annotated points annotated for bleached Sinularia.

Clad

Percent of total annotated points annotated for Cladiella.

EncBry

Percent of total annotated points annotated for encrusting Bryozoan.

EUR

Percent of total annotated points annotated for sea urchin.

HYDCO

Percent of total annotated points annotated for Hydrocoral.

Hydra

Percent of total annotated points annotated for Hydroid.

Mille

Percent of total annotated points annotated for Millepora.

MOBI

Percent of total annotated points annotated for bivalves.

Sarco

Percent of total annotated points annotated for Sarcophyton.

SECO

Percent of total annotated points annotated for sea cucumber.

Sinu

Percent of total annotated points annotated for Sinularia.

Sponge

Percent of total annotated points annotated for sponge.

Stylas

Percent of total annotated points annotated for Stylaster.

UnkTUN

Percent of total annotated points annotated for unknown Tunicate.

XmasW

Percent of total annotated points annotated for Christmas Tree Worm.

ZOAN

Percent of total annotated points annotated for Zoanthid.

B_Sarco

Percent of total annotated points annotated for bleached Sarcophyton.

Sand

Percent of total annotated points annotated for sand.

Sediment

Percent of total annotated points annotated for sediment.

SCRO

Percent of total annotated points annotated for consolidated rock.

B_Loph

Percent of total annotated points annotated for bleached Lobophytum.

CYAN

Percent of total annotated points annotated for Cyanobacteria films.

Loph

Percent of total annotated points annotated for Lobophytum.

Rubble

Percent of total annotated points annotated for broken coral rubble.

SHAD

Percent of total annotated points annotated for shadow.

Trans

Percent of total annotated points annotated for transect hardware.

Unc

Percent of total annotated points annotated for unclear.

AVRA

Percent of total annotated points annotated for Avrainvillea.

Caul

Percent of total annotated points annotated for Caulerpa.

CCA

Percent of total annotated points annotated for crustose coraline algae.

Dict

Percent of total annotated points annotated for Dictyota.

DICTY

Percent of total annotated points annotated for Dictyosphaeria.

Hali

Percent of total annotated points annotated for Halimeda.

Lobph

Percent of total annotated points annotated for Lobophora.

Macro

Percent of total annotated points annotated for macroalgae.

Mdict

Percent of total annotated points annotated for Microdictyon.

Pad

Percent of total annotated points annotated for Padina.

Peysson

Percent of total annotated points annotated for Peyssonnelia.

Turf

Percent of total annotated points annotated for turf algae.

TURFH

Percent of total annotated points annotated for turf algae on hard substrate.

Unidentified

Percent of total annotated points annotated that were unidentified.


Sum columns based on matching names

Description

Select columns and attach a vector of their new names, then columns with matching names will have each row summed. This is helpful to simplify your data quickly, like simplifying at a higher taxonomic group.

Usage

sum_cols(data, from, to)

Arguments

data

A data frame.

from

The column names in data.

to

A vector of new names, with matching names being the columns where each row will be summed.

Value

A data frame with summed columns.

Examples

Sites <- as.factor(c("One", "One", "One", "Two", "Two", "Three"))
Transect <- as.factor(c("1-Deep", "1-Shallow", "2-Shallow", "1-Shallow", "1-Deep", "1-Deep"))
Acropora.tabulate <- c(0.1, 0.6, 0.4, 0.9, 0.2, 0)
Acropora.corymbose <- c(0.4, 0, 0.1, 0, 0.3, 0.5)
Gardineroseris.sp <- c(0.4, 0.9, 0.5, 0.23, 0.5, 0.6)
Psammocora.sp <- c(0.9, 0.6, 0.5, 0.8, 0.1, 0.4)
Leptastrea.sp <- c(0.5, 0.7, 0.4, 0.8, 0.2, 0.3)
coral_cover <- data.frame(Sites, Transect, Acropora.tabulate, Acropora.corymbose,
                          Gardineroseris.sp, Psammocora.sp, Leptastrea.sp)

new_names <- c("Acropora.spp", "Acropora.spp", "Gardineroseris.sp",
               "Psammocora.sp", "Leptastrea.sp")

sum_cols(data = coral_cover, from = colnames(coral_cover[,3:7]),
         to = new_names)

Extract usable observations

Description

Sum columns containing unusable observations and remove rows that contain more than the specified cutoff number of unusable points. Helpful if there are annotations that were unidentifiable and you want to remove them from the total usable observations, and you can remove quadrats with too many unusable observations.

Usage

usable_obs(
  data,
  unusable,
  max = FALSE,
  cutoff,
  above_cutoff = FALSE,
  rm_unusable = TRUE
)

Arguments

data

A data frame with each row representing a sampling unit (ex. a quadrat or photo).

unusable

A vector of column names containing unusable observations.

max

If max = FALSE, no threshold will be examined. If max = TRUE, a threshold cutoff needs to be provided where rows containing more than the cutoff will be removed from the data frame.

cutoff

The threshold number where rows containing more unusable observations than the cutoff will be removed from the data frame.

above_cutoff

If above_cutoff = TRUE, the data frame returned will be the rows containing more unusable observations than the cutoff. If above_cutoff = FALSE the data frame returned will be the rows containing equal to or less unusable observations than the cutoff.

rm_unusable

If rm_unusable = TRUE, the columns named in the unusable vector will be removed from the data frame. These columns will not be removed if rm_unusable = FALSE, though duplicate data will remain.

Value

A data frame containing summed unusable points.

Examples

#create data set for example
Sites <- as.factor(c("One", "One", "Two", "Two", "Three", "Three"))
Transect <- as.factor(c("1-Shallow", "2-Shallow", "1-Shallow", "2-Shallow",
    "1-Shallow", "2-Shallow"))
Acropora.sp <- c(1, 2, 3, 4, 5, 6)
Gardineroseris.sp <- c(6, 1, 2, 3, 4, 5)
Psammocora.sp <- c(5, 6, 1, 2, 3, 4)
Leptastrea.sp <- c(4, 5, 6, 1, 2, 3)
Blurry <- c(3, 4, 5, 6, 1, 2)
Unk <- c(2, 3, 4, 5, 6, 1)
coral_cover <- data.frame(Sites, Transect, Acropora.sp, Gardineroseris.sp,
                          Psammocora.sp, Leptastrea.sp, Blurry, Unk)


usable_obs(coral_cover, c("Blurry", "Unk"))

usable_obs(coral_cover, c("Blurry", "Unk"), above_cutoff = TRUE)

usable_obs(coral_cover, c("Blurry", "Unk"), rm_unusable = FALSE)

usable_obs(coral_cover, c("Blurry", "Unk"), max = TRUE, cutoff = 8)

usable_obs(coral_cover, c("Blurry", "Unk"), max = TRUE, cutoff = 8, above_cutoff = TRUE)

Visualize cleaned data

Description

Using an interactive shiny app, visualize and explore cleaned quadrat data.

Usage

visualize_app(data, xaxis, yaxis)

Arguments

data

A data frame containing cleaned quadrat data.

xaxis

The xaxis variable column names found in data.

yaxis

The yaxis variable column names found in data.

Value

A shiny app launched in your browser.

Examples

year <- sample(x = seq(from = 2000, to = 2020, by = 1), 1000, replace = TRUE)
site <- sample(x = c("site1", "site2", "site3", "site4", "site5"), 1000, replace = TRUE)
transect <- sample(x = c("transect1", "transect2", "transect3", "transect4"),
    1000, replace = TRUE)
species <- sample(x = c("Acropora", "Gardineroseris", "Psammocora", "Leptastrea"),
    1000, replace = TRUE)
cover <- sample(x = seq(from = 0, to = 1, by = 0.01), 1000, replace = TRUE)

coral <- data.frame(year, site, transect, species, cover)

if (interactive()) {
visualize_app(data = coral, xaxis = colnames(coral[,1:4]), yaxis = "cover")
}