Learn R Programming

Momocs (version 1.4.1)

rm_uncomplete: Remove shapes with incomplete slices

Description

Imagine you take three views of every object you study. Then, you can slice, filter or chop your entire dataset, do morphometrics on it, then want to combine it. But if you have forgotten one view, or if it was impossible to obtain, for one or more objects, combine will not work. This function helps you to remove those ugly ducklings. See examples

Usage

rm_uncomplete(x, id, by)

Value

a Momocs object of same class

Arguments

x

the object on which to remove uncomplete "by"

id

of the objects, within the $fac slot

by

which column of the $fac should objects have complete views

See Also

Other handling functions: arrange(), at_least(), chop(), combine(), dissolve(), fac_dispatcher(), filter(), mutate(), rename(), rescale(), rm_harm(), rm_missing(), rw_fac(), sample_frac(), sample_n(), select(), slice(), subsetize()

Examples

Run this code
# we load olea
data(olea)
# we select the var Aglan since it is the only one complete
ol <- filter(olea, var == "Aglan")
# everything seems fine
table(ol$view, ol$ind)
# indeed
rm_uncomplete(ol, id="ind", by="view")

# we mess the ol object by removing a single shape
ol.pb <- slice(ol, -1)
table(ol.pb$view, ol.pb$ind)
# the counterpart has been removed with a notice
ol.ok <- rm_uncomplete(ol.pb, "ind", "view")
# now you can combine them
table(ol.ok$view, ol.ok$ind)

Run the code above in your browser using DataLab