rs_setsoftwo: Rat-Stats Style Sets of Two Random Numbers

Description Usage Arguments Value Examples

View source: R/rs_setsoftwo.R

Description

Rat-Stats Style Sets of Two Random Numbers

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
rs_setsoftwo(
  df = NULL,
  first_set,
  second_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
)

Arguments

df

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

first_set

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

second_set

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

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 and second_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
#Create three separate data frames
df1 <- data.frame(page = c(1),
                 score = rnorm(10, 7,2),
                 item = 1:10)
df2 <- data.frame(page = c(2),
                 score = rnorm(10, 6, 1.5),
                 item = 1:10)
df3 <- data.frame(page = c(3),
                 score = rnorm(10, 8, 0.5),
                 item = 1:10)

#Combine the data frames
df_combined <- rbind(df1, df2, df3)
#Randomly pull observations from df_combined
combined_out <- rs_setsoftwo(df = df_combined,
                            first_set = page,
                            second_set = item,
                            seed_number = NA,
                            audit_review = "",
                            quantity_to_generate = 10,
                            quantity_of_spares = 2,
                            first_set_low = 1,
                            first_set_high = 3,
                            second_set_low = 1,
                            second_set_high = 10)

#View head
head(combined_out$output$sample)

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