missing.legs: Missing Legs

View source: R/missing.legs.R

missing.legsR Documentation

Missing Legs

Description

Functions for formatting and checking whether a crustacean has missing legs.

Usage

missing.legs(x, ...)

## S3 method for class 'data.frame'
missing.legs(x)

## Default S3 method:
missing.legs(x)

## S3 method for class 'numeric'
missing.legs(x)

## S3 method for class 'character'
missing.legs(x)

is.missing.legs(x, ...)

## S3 method for class 'character'
is.missing.legs(x, side, include.regenerated = FALSE, ...)

## S3 method for class 'data.frame'
is.missing.legs(x, side, include.regenerated = FALSE, ...)

bin2str.missing.legs(x)

Arguments

x

Numerical code(s), character string(s) or list objects.

Value

Character string(s) of logical values.

Standard missing legs format

The standard missing leg format is a 10-character string with the proper missing legs codes. The first five characters correspond to the left-hand side pereiopds, numbered starting with the chela. The last 5 characters correspond to those of the right-hand side.

For example ‘**2***1***’ indicates that the 3rd leg on the left-hand side is regenerated, while the 2nd leg on the right-hand side is missing.

Functions

missing.legs

Generic missing.legs method.

missing.legs.default

Default missing.legs method.

missing.legs.numeric

Returns a missing legs description for a specified missing legs code. If no code is given, then a named character vector of all missing legs names for a given survey is returned. Unknown codes and NA values are returned as NA values.

missing.legs.character

Function to convert non-standard character string input to the standard missing legs format. The function identifies certain character string fragments as relevant for missing legs codes. For example, ‘"R2M L3R"’ specifies that the 2nd leg on the right-hand side is missing while the 3rd leg on the left-hand side is regenerated. This string translates to ‘**2***1***’ in the standard format. It is also possible to use a more compact coding available such as ‘"R23 L12R3R"’, which specifies that the 2nd and 3rd legs on the right-hand side is missing, and the first leg on the left-hand side is missing, while the 2nd and 3rd ones are regenerated. This string translates to ‘122***11**’ in the standard format. If entries are already in the standard format, then a numerical matrix version of the missing leg pattern is returned.

is.missing.legs

Generic is.missing.legs function.

is.missing.legs.character

Returns whether a crustacean has missing legs.

is.missing.legs.list

Returns whether a crustacean has missing legs for an given object containing missing leg data observations.

Examples

# Return all missing legs code descriptions:
missing.legs()
   
# Missing legs descriptions for specified codes:
missing.legs(c(1, 1, 2, 3)) 

# A rich sample of test cases:
str <- c("11 L234 R34R", "15 R2M L3R L4M L5", "  ", "", "56", "r3",
         "15 L2,3,5,R2,4", "That's R2 right", "R234  L2,3r", "l3r", " 34 what",
         "L1,3,2R", "This a comment", "R234r5r, l12r3, 49")

# Convert to standard format:
missing.legs(str)

# Convert standard format to matrix format:
missing.legs(c("*111***12*", "**211*1***", "**********"))

# Read 2010 crab data:
x <- read.scsbio(year = 2010)
   
# Remove specimens with missing legs:
x <- x[is.missing.legs(x), ]


TobieSurette/gulf.data documentation built on Jan. 19, 2025, 7:50 p.m.