diff --git a/R/mysubset.R b/R/mysubset.R index fd0a3f5..1e74c86 100644 --- a/R/mysubset.R +++ b/R/mysubset.R @@ -1,13 +1,13 @@ mysubset <- function(small, large) { -# function p=mysubset(small,large) -# % MYSUBSET Is the small set of +ve integers a subset of the large set? -# % p = mysubset(small, large) + # MYSUBSET Is the small set of + ve integers a subset of the large set? + # p <- mysubset(small, large) -# % Surprisingly, this is not built-in. + # Surprisingly, this is not built - in. -# if isempty(small) -# p = 1; % isempty(large); -# else -# p = length(myintersect(small,large)) == length(small); -# end + if (is.null(small)) { + p <- 1# is.null(large) + } else { + p <- length(myintersect(small, large)) == length(small) + } + return(p) }