Sha256: b0962d03db87939259b0f49b28960c17e730454a01d377053f57ea60866f1f6a
Contents?: true
Size: 595 Bytes
Versions: 121
Compression:
Stored size: 595 Bytes
Contents
anagram <- function(subject,candidates) { # subject is a string # candidates is a character vector # break subject into vector of characters subject <- tolower(subject) test_candidates <- tolower(candidates) l <- strsplit(subject,"")[[1]] # sub out each character from l in candidates for (i in l) { test_candidates <- sub(i,"",test_candidates) } result <- candidates[test_candidates=="" & tolower(candidates) != subject & nchar(candidates) == length(l)] if (length(result)==0) { return(c()) } return(result) }
Version data entries
121 entries across 121 versions & 1 rubygems