Learn R Programming

nbpMatching (version 1.5.6)

assign.grp: Random Group Assignment

Description

Randomly assign each element into treatment group A or B.

Usage

assign.grp(matches, seed = 68, ...)

Value

original data.frame with treatment group column

Arguments

matches

A data.frame or nonbimatch object. Contains information on how to match the covariate data set.

seed

Seed provided for random-number generation. Default value of 68.

...

Additional arguments, not used at the moment.

Author

Cole Beck

Details

This function takes the matched pairs generated by nonbimatch and randomly assigns each element to a group.

See Also

nonbimatch

Examples

Run this code

df <- data.frame(id=LETTERS[1:25], val1=rnorm(25), val2=rnorm(25))
df.dist <- gendistance(df, idcol=1)
df.mdm <- distancematrix(df.dist)
df.match <- nonbimatch(df.mdm)
assign.grp(df.match)
assign.grp(df.match$matches)

Run the code above in your browser using DataLab