ithcase: Substract 'i'th Cases of the Data

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/ithcase.R

Description

Substracts the $i$th cases of x along each level of factor y. The function is useful for vectorized data, vhen items are repeated in known sequences.

Usage

1
ithcase(x, y, i = 1, na.rm = FALSE)

Arguments

x

a vector to be substracted.

y

a vector which is used to determine repeating sequences of the valoes of x. Unique values or factor levels are used for this.

i

numeric, determines position of values taken from x within levels of y. Can be a single value or a vector. If it is vector, its length must be same as unique values in y.

na.rm

logical, shoulr NAs removed from the result? The removel of NAs takes place befor subtsracting.

Details

x and y should be of the same lengths.

Value

A vector with length same as number of levels, or unique values in y. If na.rm = TRUE, it can be shorter, because the removal of NA values takes place prior to substracting. Names of the result is same as levels of y.

Author(s)

P\'eter S\'olymos, solymos@ualberta.ca

References

http://www.abmi.ca/

See Also

abmi.is.na

Examples

1
2
data(abmi.data)
ithcase(abmi.data$sitecap[,9], abmi.data$sitecap$ABMI.Site)

abmiOld documentation built on May 2, 2019, 5:54 p.m.

Related to ithcase in abmiOld...