Translated mysubset()

This commit is contained in:
Waldir Leoncio 2022-12-22 13:31:41 +01:00
parent 73438af7bb
commit a757a4435c

View file

@ -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)
}