Introduction

On occasion, a researcher may need to remove one or more individuals or landmarks from their study. This could, for example, be because a specimen is damaged or doesn’t fit the necessary criteria, or because a particular landmark turns out to be out-of-tolerance in terms of error.

The approach for deleting specimens and landmarks in R is similar to what we do for Reflecting Landmarks, in that we must access the level of interest in our 3D array, and modify it. Likewise, the approach is slightly different depending on whether or not the specimens or landmarks to be deleted are sequential.

Deleting Specimens

If we decide that a single specimen in our dataset should be removed, say specimen number four, we do the following:

data.mod <- data[,,-4]



Alternatively, if multiple specimens in sequence need to be removed (say, 4 through 8), we can do this:

data.mod <- data[,,-(4:8)]
dim(data.mod)
## [1] 12  2 35



One additional step is required to delete multiple specimens that are out-of-sequence. We must create a vector that lists the specimen numbers to be deleted, and then perform the above step with that vector, like so:

omit <- c(4,9,15,28)
data.mod <- data[,,-omit]
dim(data.mod)
## [1] 12  2 36



Deleting Landmarks

The process for removing landmarks is essentially identical to removing specimens. We just need to access a different index of our 3D array.

Removing a single landmark:

data.mod <- data[-4,,]
dim(data.mod)
## [1] 11  2 40



Removing multiple landmarks in-sequence:

data.mod <- data[-(4:8),,]
dim(data.mod)
## [1]  7  2 40



And multiple landmarks out-of-sequence:

omit <- c(2,5,7)
data.mod <- data[-omit,,]
dim(data.mod)
## [1]  9  2 40