Learn R Programming

autoFC (version 0.2.0.1002)

make_random_block: Construction of Random Item Blocks

Description

Returns a matrix of randomly paired blocks where each row represents a block.

Usage

make_random_block(total_items, target_items = total_items, item_per_block)

Value

A matrix of integers indicating the item numbers, where the number of rows equals target_items divided by item_per_block, rounded up, and number of columns equals item_per_block.

Arguments

total_items

Integer value. Determines the total number of items we sample from.

target_items

Integer value. Determines the number of items to use from total_items to build item blocks. Default to be equal to total_items. Should be no more than total_items.

item_per_block

Integer value. Determines the number of items in each item block. Should be no less than 2.

Author

Mengtong Li

Details

Given the total number of items to pair from, number of items to build paired blocks and number of items in each block, make_random_block produces a matrix randomly paired blocks where each row represents a block.

It can also accommodate cases when target_items is not a multiple of item_per_block.

Can be used as initial solution for other functions in this package.

Examples

Run this code
# Try out cases where you make target_items the default.
make_random_block(60, item_per_block = 3)

# You can also set your own values of target_items.
make_random_block(60, 45, item_per_block = 3)

# Also see what happens if target_items is not a multiple of item_per_block.
make_random_block(60, 50, item_per_block = 3)

Run the code above in your browser using DataLab