Learn R Programming

mefa (version 1.1-4)

mxcount: Merge Two Objects of Class 'xcount'

Description

The function merges two objects of class 'xcount'. Rows with zero total counts are handled internally by functions msscount and ttsscount.

Usage

mxcount(xc1, xc2, segment = "unspecified")

Arguments

xc1
an object of class 'xcount'.
xc2
an object of class 'xcount'.
segment
arbitrary name of the segment (eg. all or mixed, see example). When segment values of xc1 and xc2 are the same, segment argument specified here has no effect and the original is retained. Whe

Value

  • A result is an object of class 'xcount'.

See Also

xcount

Examples

Run this code
ss1 <- data.frame(
cbind(
c("sample1","sample1","sample2","sample2","sample3","sample4"),
c("species1","species1","species1","species2","species3","zero.count"),
c("male","female","male","female","male","male")
),
c(1, 2, 10, 3, 4, 1)
)
colnames(ss1) <- c("sample.id", "species.id", "gender", "catch")

ss2 <- data.frame(
cbind(
c("sample1","sample1","sample5","sample5"),
c("species1","species4","species1","species5"),
c("male","female","male","female")
),
c(3, 2, 1, 4)
)
colnames(ss2) <- c("sample.id", "species.id", "gender", "catch")

xc1 <- xcount(sscount(ss1, zc="zero.count"))
xc2 <- xcount(sscount(ss1, zc="zero.count"), 1)
xc3 <- xcount(sscount(ss2))

mxcount(xc1, xc2, "mixed")
mxcount(xc1, xc3)

Run the code above in your browser using DataLab