Description Usage Arguments Value Examples
View source: R/rs_setsofthree.R
Rat-Stats Style Sets of Three Random Numbers
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | rs_setsofthree(
df = NULL,
first_set,
second_set,
third_set,
seed_number = NA,
audit_review = "",
quantity_to_generate = 0,
quantity_of_spares = 0,
first_set_low = 1,
first_set_high = 1,
second_set_low = 1,
second_set_high = 1,
third_set_low = 1,
third_set_high = 1
)
|
df |
A data frame containing an index for the first, second, and third set of numbers |
first_set |
Column name for first set of numbers (i.e., time, volumne) |
second_set |
Column name for second set of numbers (i.e., page, source, or data frame id) |
third_set |
Column name for third set of numbers (i.e., line, observation, or row id) |
seed_number |
"Do you want to provide seed number?" Provide a seed number. If the default (seed_number = NA) is retained then the seed number will be set to sample(0:1000000, 1) and the result will be returned in the output. |
audit_review |
"Name of the Audit/Review" |
quantity_to_generate |
"Enter the quantity of numbers to be generated in Random Order." |
quantity_of_spares |
"Enter the quantity of Spare numbers to be generated in Random Order:" |
first_set_low |
Enter the low number for the sampling frame's first set |
first_set_high |
Enter the high number for the sampling frame's first set |
second_set_low |
Enter the low number for the sampling frame's second set |
second_set_high |
Enter the high number for the sampling frame's second set |
third_set_low |
Enter the low number for the sampling frame's third set |
third_set_high |
Enter the high number for the sampling frame's third set |
A nested list with "output" and "input" lists. The output list contains three data frames: the sample, the sample frame, and the spares. Each data frame includes the random numbers (in the order variable) and each has been sorted by first_set, second_set, and third_set. The input list returns input parameters and the random number seed.
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 | #Create six separate data frames
df1_pre <- data.frame(time = 1,
page = c(1),
score = rnorm(10, 7,2),
item = 1:10)
df2_pre <- data.frame(time = 1,
page = c(2),
score = rnorm(10, 6, 1.5),
item = 1:10)
df3_pre <- data.frame(time = 1,
page = c(3),
score = rnorm(10, 8, 0.5),
item = 1:10)
df1_post <- data.frame(time = 2,
page = c(1),
score = rnorm(10, 7,2),
item = 1:10)
df2_post <- data.frame(time = 2,
page = c(2),
score = rnorm(10, 6, 1.5),
item = 1:10)
df3_post <- data.frame(time = 2,
page = c(3),
score = rnorm(10, 8, 0.5),
item = 1:10)
#Combine the data frames
df_combined <- rbind(df1_pre, df2_pre, df3_pre,
df1_post, df2_post, df3_post)
#Randomly pull observations from df_combined
combined_out <- rs_setsofthree(df = df_combined,
first_set = time,
second_set = page,
third_set = item,
seed_number = NA,
audit_review = "",
quantity_to_generate = 10,
quantity_of_spares = 2,
first_set_low = 1,
first_set_high = 2,
second_set_low = 1,
second_set_high = 3,
third_set_low = 1,
third_set_high = 10)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.