rs_setsoffour: Rat-Stats Style Sets of Four Random Numbers

Description Usage Arguments Value Examples

View source: R/rs_setsoffour.R

Description

Rat-Stats Style Sets of Four Random Numbers

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
rs_setsoffour(
  df = NULL,
  first_set,
  second_set,
  third_set,
  fourth_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,
  fourth_set_low = 1,
  fourth_set_high = 1
)

Arguments

df

A data frame containing an index for the first, second, third, and fourth set of numbers

first_set

Column name for first set of numbers (i.e., session)

second_set

Column name for second set of numbers (i.e., time, volumne)

third_set

Column name for third set of numbers (i.e., page, source, or data frame id)

fourth_set

Column name for fourth 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

fourth_set_low

Enter the low number for the sampling frame's fourth set

fourth_set_high

Enter the high number for the sampling frame's fourth set

Value

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, third_set, and fourth_set. The input list returns input parameters and the random number seed.

Examples

 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
64
#Create 8 separate data frames
df1_pre    <- data.frame(session = 1,
                        time = 1,
                        page = c(1),
                        score = rnorm(10, 7,2),
                        item = 1:10)
df2_pre    <- data.frame(session = 1,
                        time = 1,
                        page = c(2),
                        score = rnorm(10, 6, 1.5),
                        item = 1:10)
df3_pre    <- data.frame(session = 2,
                        time = 1,
                        page = c(3),
                        score = rnorm(10, 8, 0.5),
                        item = 1:10)
df4_pre    <- data.frame(session = 2,
                        time = 1,
                        page = c(4),
                        score = rnorm(10, 8, 0.5),
                        item = 1:10)
df1_post    <- data.frame(session = 1,
                         time = 2,
                         page = c(1),
                         score = rnorm(10, 7,2),
                         item = 1:10)
df2_post    <- data.frame(session = 1,
                         time = 2,
                         page = c(2),
                         score = rnorm(10, 6, 1.5),
                         item = 1:10)
df3_post    <- data.frame(session = 2,
                         time = 2,
                         page = c(3),
                         score = rnorm(10, 8, 0.5),
                         item = 1:10)
df4_post    <- data.frame(session = 2,
                         time = 2,
                         page = c(4),
                         score = rnorm(10, 8, 0.5),
                         item = 1:10)

#Combine the data frames
df_combined <- rbind(df1_pre, df2_pre, df3_pre, df4_pre,
                    df1_post, df2_post, df3_post, df4_post)

#Randomly pull observations from df_combined
combined_out <- rs_setsoffour(df = df_combined,
                             first_set = time,
                             second_set = session,
                             third_set = page,
                             fourth_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 = 2,
                             third_set_low = 1,
                             third_set_high = 3,
                             fourth_set_low = 1,
                             fourth_set_high = 10)

mncube/claimr documentation built on Dec. 21, 2021, 8:07 p.m.