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 |
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.
add_data(data, add, cols, data_id, add_id, number = FALSE)
add_data(data, add, cols, data_id, add_id, number = FALSE)
data |
A data frame you want to add columns to. |
add |
A data frame with columns you want to add to |
cols |
The column names from |
data_id |
The ID column in |
add_id |
The ID column in |
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. |
A data frame with added columns.
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)
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)
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.
categorize(data, column, values, name, binary = TRUE, exact = TRUE, categories)
categorize(data, column, values, name, binary = TRUE, exact = TRUE, categories)
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 |
exact |
If |
categories |
The factor names denoting the presence of the characters or
parts of characters specified by |
A data frame with new categorization column.
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)
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)
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.
change_names(data, labelset, from, to)
change_names(data, labelset, from, to)
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. |
A data frame containing new column names.
#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")
#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")
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.
change_values(data, column, from, to)
change_values(data, column, from, to)
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 |
A data frame containing new values within the specified column.
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"))
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"))
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.
coral_labelset
coral_labelset
A data_frame
with 5 columns, which are:
The short name ID used to annotate the photo quadrats.
The long name and definition for each short name ID.
The taxonomic grouping name for each short name ID.
The functional group for each ID.
The life history category for each coral ID.
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.
corals
corals
A data_frame
with 14 columns, which are:
Field season ID.
Site number.
Quadrat ID.
Percent of total annotated points annotated for Acropora (corymbose morphology).
Percent of total annotated points annotated for Acropora (digitate morphology).
Percent of total annotated points annotated for Acropora (tabulate morphology).
Percent of total annotated points annotated for Montastraea.
Percent of total annotated points annotated for Leptastrea.
Percent of total annotated points annotated for Sinularia.
Percent of total annotated points annotated for Cladiella.
Percent of total annotated points annotated for Lobophora.
Percent of total annotated points annotated for Sarcophyton.
Percent of total annotated points annotated for unclear.
Percent of total annotated points annotated for shadow.
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.
cover_calc(data, spp, prop = TRUE, total = FALSE)
cover_calc(data, spp, prop = TRUE, total = FALSE)
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 |
total |
If |
A data frame containing scaled observation cover.
#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)
#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)
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.
crop_area( data, row, column, id, dim, obs_rm = FALSE, obs_range, res = FALSE, res_dim_x, res_dim_y )
crop_area( data, row, column, id, dim, obs_rm = FALSE, obs_range, res = FALSE, res_dim_x, res_dim_y )
data |
A data frame containing annotations, in long format, such that all observations are contained in one column. |
row |
The column name in |
column |
The column name in |
id |
The column name in |
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_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_dim_x |
The column name in |
res_dim_y |
The column name in |
A data frame in of quadrat annotations with a subset of annotated points.
#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")
#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")
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.
environmental_data
environmental_data
A data_frame
with 7 columns, which are:
Site number.
Estimate of local human disturbance at each site as a categorical variable.
Estimate of local human disturbance at each site as a continuous variable.
Max net primary productivity at each site (mg C m^-2 day^-1).
If the sampling site is on the sheltered or windward side of the atoll.
Region of the atoll.
Wave energy at each site (kW m^-1).
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.
final_cleaned
final_cleaned
A data_frame
with 14 columns, which are:
Field season ID.
If the sampling season was before, during or after the El Niño event.
Site number.
Quadrat ID.
Estimate of local human disturbance at each site as a categorical variable.
Estimate of local human disturbance at each site as a continuous variable.
Max net primary productivity at each site (mg C m^-2 day^-1).
If the sampling site is on the sheltered or windward side of the atoll.
Region of the atoll.
Wave energy at each site (kW m^-1).
Taxonomic name for each substrate.
Functional group for each substrate.
Life history classification for each substrate.
The proportion cover for each substrate.
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.
keep_rm( data, values, select, keep = TRUE, drop_levels = TRUE, exact = TRUE, colname )
keep_rm( data, values, select, keep = TRUE, drop_levels = TRUE, exact = TRUE, colname )
data |
A data frame. |
values |
A vector containing the characters or parts of characters to base selection off of. |
select |
If |
keep |
If |
drop_levels |
If |
exact |
If |
colname |
If |
A data frame containing new selection of data.
# 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)
# 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)
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.
rm_chr(data, rm, full_selection = TRUE, cols)
rm_chr(data, rm, full_selection = TRUE, cols)
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 |
cols |
If |
A data frame containing the selected parts of characters removed.
# 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"))
# 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"))
Specify which columns to use to produce a table with sample sizes. Helpful to visualize number of samples in your data.
sample_size(data, dim_1, dim_2, count)
sample_size(data, dim_1, dim_2, count)
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 |
dim_2 |
The second dimension to calculate sample sizes for. This will be the
resulting column names. This must be the column name within |
count |
The column name within |
A data frame of sample sizes.
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")
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")
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.
softcoral_annotations
softcoral_annotations
A data_frame
with 4 columns, which are:
Unique identification code for each quadrat.
The pixel row where the annotation occurred in the photo of the quadrat.
The pixel column where the annotation occurred in the photo of the quadrat.
The identification for the substrate below the annotation location.
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.
softcoral_LQuads
softcoral_LQuads
A data_frame
with 135 columns, which are:
Photo quadrat image ID from CoralNet.
The photo quadrat image name.
If the quadrat has been completely annotated, or if there are more annotations to occur.
The total number of annotation points in the quadrat.
Percent of total annotated points annotated for Acropora (corymbose morphology).
Percent of total annotated points annotated for Acropora (digitate morphology).
Percent of total annotated points annotated for Acropora (arborescent morphology).
Percent of total annotated points annotated for Acropora.
Percent of total annotated points annotated for Acropora (tabulate morphology).
Percent of total annotated points annotated for Astreopora.
Percent of total annotated points annotated for bleached Acropora (arborescent morphology)
Percent of total annotated points annotated for bleached Acropora.
Percent of total annotated points annotated for bleached Astreopora.
Percent of total annotated points annotated for bleached Acropora (tabulate morphology).
Percent of total annotated points annotated for bleached Coscinarea.
Percent of total annotated points annotated for bleached Echinophyllia.
Percent of total annotated points annotated for bleached Favites halicora.
Percent of total annotated points annotated for bleached_Favia.
Percent of total annotated points annotated for bleached Favia matthaii.
Percent of total annotated points annotated for bleached Favia speciosa.
Percent of total annotated points annotated for bleached Goniastrea stelligera.
Percent of total annotated points annotated for bleached Favites.
Percent of total annotated points annotated for bleached Favites pentagona.
Percent of total annotated points annotated for bleached Fungia.
Percent of total annotated points annotated for bleached Gardineroseris.
Percent of total annotated points annotated for bleached Goniastrea edwardsi.
Percent of total annotated points annotated for bleached Herpolitha.
Percent of total annotated points annotated for bleached Hydnophora.
Percent of total annotated points annotated for bleached Hydnophora exesa.
Percent of total annotated points annotated for bleached Acropora (corymbose morphology).
Percent of total annotated points annotated for bleached Leptastrea.
Percent of total annotated points annotated for bleached Leptoseris.
Percent of total annotated points annotated for bleached Isopora.
Percent of total annotated points annotated for bleached Lobophyllia.
Percent of total annotated points annotated for bleached Turbinaria (foliose morphology).
Percent of total annotated points annotated for bleached Montipora (encrusting morphology).
Percent of total annotated points annotated for bleached Montipora (foliose morphology).
Percent of total annotated points annotated for bleached Montastraea.
Percent of total annotated points annotated for bleached Montipora.
Percent of total annotated points annotated for bleached Oxypora.
Percent of total annotated points annotated for bleached Palythoa.
Percent of total annotated points annotated for bleached Pavona duerdeni.
Percent of total annotated points annotated for bleached Pavona.
Percent of total annotated points annotated for bleached Pocillopora eydouxi.
Percent of total annotated points annotated for bleached Platygyra.
Percent of total annotated points annotated for bleached Pocillopora meandrina.
Percent of total annotated points annotated for bleached Pocillopora.
Percent of total annotated points annotated for bleached Porites.
Percent of total annotated points annotated for bleached Psammocora.
Percent of total annotated points annotated for bleached Pavona varians.
Percent of total annotated points annotated for bleached Sandolitha.
Percent of total annotated points annotated for bleached unknown hard coral.
Percent of total annotated points annotated for Cirrhipathes.
Percent of total annotated points annotated for Coscinaraea.
Percent of total annotated points annotated for Echinophyllia.
Percent of total annotated points annotated for Favites.
Percent of total annotated points annotated for Favites halicora.
Percent of total annotated points annotated for Favia.
Percent of total annotated points annotated for Dipsastraea matthaii.
Percent of total annotated points annotated for Favia speciosa.
Percent of total annotated points annotated for Favia stelligera.
Percent of total annotated points annotated for Favites pentagona.
Percent of total annotated points annotated for Fungia.
Percent of total annotated points annotated for Gardineroseris.
Percent of total annotated points annotated for Goniastrea edwardsi.
Percent of total annotated points annotated for Herpolitha.
Percent of total annotated points annotated for Hydnophora.
Percent of total annotated points annotated for Hydnophora exesa.
Percent of total annotated points annotated for Isopora.
Percent of total annotated points annotated for Leptastrea.
Percent of total annotated points annotated for Leptoseris.
Percent of total annotated points annotated for Lobophyllia.
Percent of total annotated points annotated for Montipora (encrusting morphology).
Percent of total annotated points annotated for Montipora (foliose morphology).
Percent of total annotated points annotated for Montastraea.
Percent of total annotated points annotated for Montipora.
Percent of total annotated points annotated for Oxypora.
Percent of total annotated points annotated for Palythoa.
Percent of total annotated points annotated for Pavona duerdeni.
Percent of total annotated points annotated for Pavona.
Percent of total annotated points annotated for Pocillopora eydouxi.
Percent of total annotated points annotated for Platygyra.
Percent of total annotated points annotated for Plerogyra.
Percent of total annotated points annotated for Pocillopora meandrina.
Percent of total annotated points annotated for Pocillopora.
Percent of total annotated points annotated for Porites.
Percent of total annotated points annotated for Psammocora.
Percent of total annotated points annotated for Pavona varians.
Percent of total annotated points annotated for Sandolitha.
Percent of total annotated points annotated for Tubastrea.
Percent of total annotated points annotated for Turbinaria.
Percent of total annotated points annotated for unknown hard coral.
Percent of total annotated points annotated for sea anemone.
Percent of total annotated points annotated for bleached Cladiella.
Percent of total annotated points annotated for bleached Sinularia.
Percent of total annotated points annotated for Cladiella.
Percent of total annotated points annotated for encrusting Bryozoan.
Percent of total annotated points annotated for sea urchin.
Percent of total annotated points annotated for Hydrocoral.
Percent of total annotated points annotated for Hydroid.
Percent of total annotated points annotated for Millepora.
Percent of total annotated points annotated for bivalves.
Percent of total annotated points annotated for Sarcophyton.
Percent of total annotated points annotated for sea cucumber.
Percent of total annotated points annotated for Sinularia.
Percent of total annotated points annotated for sponge.
Percent of total annotated points annotated for Stylaster.
Percent of total annotated points annotated for unknown Tunicate.
Percent of total annotated points annotated for Christmas Tree Worm.
Percent of total annotated points annotated for Zoanthid.
Percent of total annotated points annotated for bleached Sarcophyton.
Percent of total annotated points annotated for sand.
Percent of total annotated points annotated for sediment.
Percent of total annotated points annotated for consolidated rock.
Percent of total annotated points annotated for bleached Lobophytum.
Percent of total annotated points annotated for Cyanobacteria films.
Percent of total annotated points annotated for Lobophytum.
Percent of total annotated points annotated for broken coral rubble.
Percent of total annotated points annotated for shadow.
Percent of total annotated points annotated for transect hardware.
Percent of total annotated points annotated for unclear.
Percent of total annotated points annotated for Avrainvillea.
Percent of total annotated points annotated for Caulerpa.
Percent of total annotated points annotated for crustose coraline algae.
Percent of total annotated points annotated for Dictyota.
Percent of total annotated points annotated for Dictyosphaeria.
Percent of total annotated points annotated for Halimeda.
Percent of total annotated points annotated for Lobophora.
Percent of total annotated points annotated for macroalgae.
Percent of total annotated points annotated for Microdictyon.
Percent of total annotated points annotated for Padina.
Percent of total annotated points annotated for Peyssonnelia.
Percent of total annotated points annotated for turf algae.
Percent of total annotated points annotated for turf algae on hard substrate.
Percent of total annotated points annotated that were unidentified.
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.
softcoral_SQuads
softcoral_SQuads
A data_frame
with 135 columns, which are:
Photo quadrat image ID from CoralNet.
The photo quadrat image name.
If the quadrat has been completely annotated, or if there are more annotations to occur.
The total number of annotation points in the quadrat.
Percent of total annotated points annotated for Acropora (corymbose morphology).
Percent of total annotated points annotated for Acropora (digitate morphology).
Percent of total annotated points annotated for Acropora (arborescent morphology).
Percent of total annotated points annotated for Acropora.
Percent of total annotated points annotated for Acropora (tabulate morphology).
Percent of total annotated points annotated for Astreopora.
Percent of total annotated points annotated for bleached Acropora (arborescent morphology).
Percent of total annotated points annotated for bleached Acropora.
Percent of total annotated points annotated for bleached Astreopora.
Percent of total annotated points annotated for bleached Acropora (tabulate morphology).
Percent of total annotated points annotated for bleached Coscinarea.
Percent of total annotated points annotated for bleached Echinophyllia.
Percent of total annotated points annotated for bleached Favites halicora.
Percent of total annotated points annotated for bleached_Favia.
Percent of total annotated points annotated for bleached Favia matthaii.
Percent of total annotated points annotated for bleached Favia speciosa.
Percent of total annotated points annotated for bleached Goniastrea stelligera.
Percent of total annotated points annotated for bleached Favites.
Percent of total annotated points annotated for bleached Favites pentagona.
Percent of total annotated points annotated for bleached Fungia.
Percent of total annotated points annotated for bleached Gardineroseris.
Percent of total annotated points annotated for bleached Goniastrea edwardsi.
Percent of total annotated points annotated for bleached Herpolitha.
Percent of total annotated points annotated for bleached Hydnophora.
Percent of total annotated points annotated for bleached Hydnophora exesa.
Percent of total annotated points annotated for bleached Acropora (corymbose morphology).
Percent of total annotated points annotated for bleached Leptastrea.
Percent of total annotated points annotated for bleached Leptoseris.
Percent of total annotated points annotated for bleached Isopora.
Percent of total annotated points annotated for bleached Lobophyllia.
Percent of total annotated points annotated for bleached Turbinaria (foliose morphology).
Percent of total annotated points annotated for bleached Montipora (encrusting morphology).
Percent of total annotated points annotated for bleached Montipora (foliose morphology).
Percent of total annotated points annotated for bleached Montastraea.
Percent of total annotated points annotated for bleached Montipora.
Percent of total annotated points annotated for bleached Oxypora.
Percent of total annotated points annotated for bleached Palythoa.
Percent of total annotated points annotated for bleached Pavona duerdeni.
Percent of total annotated points annotated for bleached Pavona.
Percent of total annotated points annotated for bleached Pocillopora eydouxi.
Percent of total annotated points annotated for bleached Platygyra.
Percent of total annotated points annotated for bleached Pocillopora meandrina.
Percent of total annotated points annotated for bleached Pocillopora.
Percent of total annotated points annotated for bleached Porites.
Percent of total annotated points annotated for bleached Psammocora.
Percent of total annotated points annotated for bleached Pavona varians.
Percent of total annotated points annotated for bleached Sandolitha.
Percent of total annotated points annotated for bleached unknown hard coral.
Percent of total annotated points annotated for Cirrhipathes.
Percent of total annotated points annotated for Coscinaraea.
Percent of total annotated points annotated for Echinophyllia.
Percent of total annotated points annotated for Favites.
Percent of total annotated points annotated for Favites halicora.
Percent of total annotated points annotated for Favia.
Percent of total annotated points annotated for Dipsastraea matthaii.
Percent of total annotated points annotated for Favia speciosa.
Percent of total annotated points annotated for Favia stelligera.
Percent of total annotated points annotated for Favites pentagona.
Percent of total annotated points annotated for Fungia.
Percent of total annotated points annotated for Gardineroseris.
Percent of total annotated points annotated for Goniastrea edwardsi.
Percent of total annotated points annotated for Herpolitha.
Percent of total annotated points annotated for Hydnophora.
Percent of total annotated points annotated for Hydnophora exesa.
Percent of total annotated points annotated for Isopora.
Percent of total annotated points annotated for Leptastrea.
Percent of total annotated points annotated for Leptoseris.
Percent of total annotated points annotated for Lobophyllia.
Percent of total annotated points annotated for Montipora (encrusting morphology).
Percent of total annotated points annotated for Montipora (foliose morphology).
Percent of total annotated points annotated for Montastraea.
Percent of total annotated points annotated for Montipora.
Percent of total annotated points annotated for Oxypora.
Percent of total annotated points annotated for Palythoa.
Percent of total annotated points annotated for Pavona duerdeni.
Percent of total annotated points annotated for Pavona.
Percent of total annotated points annotated for Pocillopora eydouxi.
Percent of total annotated points annotated for Platygyra.
Percent of total annotated points annotated for Plerogyra.
Percent of total annotated points annotated for Pocillopora meandrina.
Percent of total annotated points annotated for Pocillopora.
Percent of total annotated points annotated for Porites.
Percent of total annotated points annotated for Psammocora.
Percent of total annotated points annotated for Pavona varians.
Percent of total annotated points annotated for Sandolitha.
Percent of total annotated points annotated for Tubastrea.
Percent of total annotated points annotated for Turbinaria.
Percent of total annotated points annotated for unknown hard coral.
Percent of total annotated points annotated for sea anemone.
Percent of total annotated points annotated for bleached Cladiella.
Percent of total annotated points annotated for bleached Sinularia.
Percent of total annotated points annotated for Cladiella.
Percent of total annotated points annotated for encrusting Bryozoan.
Percent of total annotated points annotated for sea urchin.
Percent of total annotated points annotated for Hydrocoral.
Percent of total annotated points annotated for Hydroid.
Percent of total annotated points annotated for Millepora.
Percent of total annotated points annotated for bivalves.
Percent of total annotated points annotated for Sarcophyton.
Percent of total annotated points annotated for sea cucumber.
Percent of total annotated points annotated for Sinularia.
Percent of total annotated points annotated for sponge.
Percent of total annotated points annotated for Stylaster.
Percent of total annotated points annotated for unknown Tunicate.
Percent of total annotated points annotated for Christmas Tree Worm.
Percent of total annotated points annotated for Zoanthid.
Percent of total annotated points annotated for bleached Sarcophyton.
Percent of total annotated points annotated for sand.
Percent of total annotated points annotated for sediment.
Percent of total annotated points annotated for consolidated rock.
Percent of total annotated points annotated for bleached Lobophytum.
Percent of total annotated points annotated for Cyanobacteria films.
Percent of total annotated points annotated for Lobophytum.
Percent of total annotated points annotated for broken coral rubble.
Percent of total annotated points annotated for shadow.
Percent of total annotated points annotated for transect hardware.
Percent of total annotated points annotated for unclear.
Percent of total annotated points annotated for Avrainvillea.
Percent of total annotated points annotated for Caulerpa.
Percent of total annotated points annotated for crustose coraline algae.
Percent of total annotated points annotated for Dictyota.
Percent of total annotated points annotated for Dictyosphaeria.
Percent of total annotated points annotated for Halimeda.
Percent of total annotated points annotated for Lobophora.
Percent of total annotated points annotated for macroalgae.
Percent of total annotated points annotated for Microdictyon.
Percent of total annotated points annotated for Padina.
Percent of total annotated points annotated for Peyssonnelia.
Percent of total annotated points annotated for turf algae.
Percent of total annotated points annotated for turf algae on hard substrate.
Percent of total annotated points annotated that were unidentified.
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.
sum_cols(data, from, to)
sum_cols(data, from, to)
data |
A data frame. |
from |
The column names in |
to |
A vector of new names, with matching names being the columns where each row will be summed. |
A data frame with summed columns.
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)
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)
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.
usable_obs( data, unusable, max = FALSE, cutoff, above_cutoff = FALSE, rm_unusable = TRUE )
usable_obs( data, unusable, max = FALSE, cutoff, above_cutoff = FALSE, rm_unusable = TRUE )
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 |
cutoff |
The threshold number where rows containing more unusable observations
than the |
above_cutoff |
If |
rm_unusable |
If |
A data frame containing summed unusable points.
#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)
#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)
Using an interactive shiny app, visualize and explore cleaned quadrat data.
visualize_app(data, xaxis, yaxis)
visualize_app(data, xaxis, yaxis)
data |
A data frame containing cleaned quadrat data. |
xaxis |
The xaxis variable column names found in |
yaxis |
The yaxis variable column names found in |
A shiny app launched in your browser.
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") }
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") }