Skip to content

Instantly share code, notes, and snippets.

View ranjiGT's full-sized avatar
🧿
Learning something new!

Ranji Raj ranjiGT

🧿
Learning something new!
View GitHub Profile
@psychemedia
psychemedia / Testing examples.md
Last active October 5, 2023 07:09
Examples of things we can test for autograding and auto-feedback

Test Examples

Trying to identify testable things for use in autograders and automated code feedback tools...

Automated testing of computer code can be used to support learning in several ways.

For example, automated tests may be used to:

@mrdwab
mrdwab / stratified.R
Last active April 27, 2024 19:57
Stratified random sampling from a `data.frame` in R
stratified <- function(df, group, size, select = NULL,
replace = FALSE, bothSets = FALSE) {
if (is.null(select)) {
df <- df
} else {
if (is.null(names(select))) stop("'select' must be a named list")
if (!all(names(select) %in% names(df)))
stop("Please verify your 'select' argument")
temp <- sapply(names(select),
function(x) df[[x]] %in% select[[x]])