I would like to create a sequence of 1:85, but excluding the numbers in seq (1.85.5). So like this:
2 3 4 5 7 8 9 10 12 13 etc..
What would be an effective way to do this in R?
Thank you very much!
Using setdiff :
setdiff
setdiff(1:85,seq(1,85,5)) [1] 2 3 4 5 7 8 9 10 12 ...
If the numbers you want to exclude cannot be generalized, @HongOoi or @James answers is the way to go. But if they can be described by some math test, Filter will be more efficient.
Filter
Filter(function(x) x %% 5 != 1, 1:85)
(1:85)[-seq(1, 85, 5)]
or is it too obvious / ineffective?
Source: https://habr.com/ru/post/1488282/More articles:javax.xml.bind.UnmarshalException: unexpected element (uri: ", local:" COUNTRY ") Expected elements: <{http://www.w3schools.com} COUNTRY> - xmlCombining the first fields of multiple objects - javascriptJAXB without marshal with declared type does not fill the resulting object with data - javahttps://translate.googleusercontent.com/translate_c?depth=1&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1488280/install-optional-desktop-shortcut-for-all-users&usg=ALkJrhiGBNkoKUU513VOJmHBkzbAiRbGxwIntelliJ Idea 12 - disable popup (ctrl + space) - intellij-ideaAndroid carousel effect with layouts - androidCan QWidget :: find widgets from another process? - qt502 Bad Gateway Django - djangoTable cell did not change correctly in Google Chrome - htmlWhat maven needs are needed for Servlet, JSP and JSTL in Java EE 7? - javaAll Articles