Sha256: 578a0e9d1c6a404b29d988d07a8884f0a3fdab0121f6f377aac68daaf8c922ce
Contents?: true
Size: 598 Bytes
Versions: 161
Compression:
Stored size: 598 Bytes
Contents
library(magrittr) allergy <- function(num) { allergy_list <- c( "eggs", "peanuts", "shellfish", "strawberries", "tomatoes", "chocolate", "pollen", "cats" ) check_allergy <- function(allergy, val) { intToBits(val)[which(allergy_list == allergy)] %>% as.logical() } allergies <- sapply(allergy_list, check_allergy, num) structure(allergy_list[allergies], class = "allergy") } allergic_to <- function(allergy_object, allergy) { allergy %in% allergy_object } list_allergies <- function(allergy_object) { as.vector(allergy_object) }
Version data entries
161 entries across 161 versions & 1 rubygems