as_xover_seq: Create an object of class 'xover_seq'

Description Usage Arguments Details Value See Also Examples

View source: R/as_xover_seq.R

Description

Converts a given matrix to an object of class xover_seq.

Usage

1
as_xover_seq(sequences, as_matrix = T, summary = T)

Arguments

sequences

A matrix whose rows and columns will be interpreted as different sequences and periods respectively. Must have at least two rows and two columns.

as_matrix

A logical variable indicating whether the sequences should be returned as a matrix, or a tibble. Defaults to T.

summary

A logical variable indicating whether a summary of the function's progress should be printed to the console. Defaults to T.

Details

as_xover_seq() supports the conversion of a matrix (see sequences) in to an object of class xover_seq, for use with other relevant functions within xover. The sequences can be returned in matrix or tibble form (see as_matrix).

Ultimately, the (k,j)th element of the cross-over design matrix corresponds to the treatment a subject on the kth sequence would receive in the jth period.

Value

Either a matrix if as_matrix = T (with rows corresponding to sequences and columns to periods), or a tibble if as_matrix = F (with rows corresponding to a particular period on a particular sequence). The object will be of class xover_seq.

See Also

The seq_#() functions within xover.

Examples

1
2
3
4
5
6
# An example cross-over design
sequences        <- matrix(c(0, 1, 0, 1, 0, 1), 2, 3, byrow = T)
# Construct a cross-over design matrix of class xover_seq
sequences_matrix <- as_xover_seq(sequences)
# Return a tibble of class xover_seq
sequences_tibble <- as_xover_seq(sequences, as_matrix = F)

mjg211/xover documentation built on Oct. 16, 2019, 10:46 a.m.