-
Notifications
You must be signed in to change notification settings - Fork 0
/
Random_groups.Rmd
64 lines (54 loc) · 2.06 KB
/
Random_groups.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
---
title: "Create random groups"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{Create random groups}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
```
```{r setup}
library(aquaras)
```
`ras.Randomizer` creates multiple series of groups each with randomly sampled observations. Observations are distributed such as that there are no repeated entries between groups/within a series.
Number of groups in a series is calculated as `length(master_list)` divided by `group_size`, rounded up to nearest integer. If an observation can not be found (for example because the groups can not be filled evenly) an error message is printed to the console and `N/A` inserted instead.
```{r}
# Example with 4 even groups
# Compound list
Compound_list = c(
"Comp_1", "Comp_2", "Comp_3", "Comp_4", "Comp_5",
"Comp_6", "Comp_7", "Comp_8", "Comp_9", "Comp_10",
"Comp_11", "Comp_12", "Comp_13", "Comp_14", "Comp_15",
"Comp_16", "Comp_17", "Comp_18", "Comp_19", "Comp_20",
"Comp_21", "Comp_22", "Comp_23", "Comp_24")
series_A = ras.Randomizer(compound_list = Compound_list,
group_size = 6,
series = 2)
print("+++++ Series A +++++")
series_A
# Example with 5 uneven groups
# Compound list
Compound_list = c(
"Comp_1", "Comp_2", "Comp_3", "Comp_4", "Comp_5",
"Comp_6", "Comp_7", "Comp_8", "Comp_9", "Comp_10",
"Comp_11", "Comp_12", "Comp_13", "Comp_14", "Comp_15",
"Comp_16", "Comp_17", "Comp_18", "Comp_19", "Comp_20",
"Comp_21", "Comp_22", "Comp_23", "Comp_24")
series_B = ras.Randomizer(Compound_list,
group_size = 5,
series = 2)
print("+++++ Series B +++++")
series_B
# Example of writing to .xlsx file
# Don't run
# Series_P = ras.Randomizer(Compound_list,
# group_size = 5,
# series = 2,
# write = TRUE,
# fileName = "Series_P Example for ras.Randomizer")
```