# NOT RUN {
# does not use Attach()
Generate <- function(condition, fixed_objects = NULL) {
N1 <- condition$sample_sizes_group1
N2 <- condition$sample_sizes_group2
sd <- condition$standard_deviations
group1 <- rnorm(N1)
group2 <- rnorm(N2, sd=sd)
dat <- data.frame(group = c(rep('g1', N1), rep('g2', N2)),
DV = c(group1, group2))
dat
}
# similar to above, but using the Attach() function instead of indexing
Generate <- function(condition, fixed_objects = NULL) {
Attach(condition)
N1 <- sample_sizes_group1
N2 <- sample_sizes_group2
sd <- standard_deviations
group1 <- rnorm(N1)
group2 <- rnorm(N2, sd=sd)
dat <- data.frame(group = c(rep('g1', N1), rep('g2', N2)),
DV = c(group1, group2))
dat
}
# }
Run the code above in your browser using DataLab