Re: [R] Remove Even Number from A Vector
On 03/03/2019 3:44 a.m., Ivan Krylov wrote: Hi Darren, On Sat, 2 Mar 2019 22:27:55 + Darren Danyluk wrote: It sounds like she is working with the very basics of this software, and her task is to write the code which would result in the extraction of "odd" data from a dataset of restaurant sales. Not a native English speaker here; what exactly do you mean by "odd" in this case? "Odd" numbers have a remainder of 1 when divided by 2; "even" numbers are multiples of 2. Duncan Murdoch If I ignore the "subject" field, it looks like your daughter should be looking for outlier detection methods. For example, https://rseek.org/ offers some good results for "outlier detection". __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Remove Even Number from A Vector
Hi Darren, On Sat, 2 Mar 2019 22:27:55 + Darren Danyluk wrote: > It sounds like she is working with the very basics of this software, > and her task is to write the code which would result in the > extraction of "odd" data from a dataset of restaurant sales. Not a native English speaker here; what exactly do you mean by "odd" in this case? If I ignore the "subject" field, it looks like your daughter should be looking for outlier detection methods. For example, https://rseek.org/ offers some good results for "outlier detection". -- Best regards, Ivan __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Remove Even Number from A Vector
Hi Darren, You're probably looking for the %% (remainder) operator: x<-1:10 # get odd numbers x[as.logical(x%%2)] # get even numbers x[!(x%%2)] Jim On Sun, Mar 3, 2019 at 4:10 PM Darren Danyluk wrote: > > Hello, > > I found this email when looking for some help with R Studio. It's actually > my daughter who is looking for help. > > It sounds like she is working with the very basics of this software, and her > task is to write the code which would result in the extraction of "odd" data > from a dataset of restaurant sales. > > This is a shot in the dark...please ignore if my question makes little or no > sense. I have no working knowledge of R software. > > Thanks. > > [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Remove Even Number from A Vector
Hello, I found this email when looking for some help with R Studio. It's actually my daughter who is looking for help. It sounds like she is working with the very basics of this software, and her task is to write the code which would result in the extraction of "odd" data from a dataset of restaurant sales. This is a shot in the dark...please ignore if my question makes little or no sense. I have no working knowledge of R software. Thanks. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Remove Even Number from A Vector
On Fri, 1 Aug 2008, Gundala Viswanath wrote: How can I remove the even number from the following vector x [1] 4 5 6 8 17 20 21 22 23 25 26 31 35 36 38 40 41 42 43 [20] 44 50 74 75 82 84 89 90 91 95 96 97 100 101 102 118 119 121 122 [39] 123 135 136 157 158 yielding 5, 17, 21, 23, 25, . (keep odd number). x[which(x %% 2 != 0)] -- SIGSIG -- signature too long (core dumped) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Remove Even Number from A Vector
x[!(x %% 2 == 0)] On Thu, Jul 31, 2008 at 10:01 PM, Gundala Viswanath [EMAIL PROTECTED]wrote: Dear all, How can I remove the even number from the following vector x [1] 4 5 6 8 17 20 21 22 23 25 26 31 35 36 38 40 41 42 43 [20] 44 50 74 75 82 84 89 90 91 95 96 97 100 101 102 118 119 121 122 [39] 123 135 136 157 158 yielding 5, 17, 21, 23, 25, . (keep odd number). - Gundala Viswanath Jakarta - Indonesia __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Remove Even Number from A Vector
Dear all, How can I remove the even number from the following vector x [1] 4 5 6 8 17 20 21 22 23 25 26 31 35 36 38 40 41 42 43 [20] 44 50 74 75 82 84 89 90 91 95 96 97 100 101 102 118 119 121 122 [39] 123 135 136 157 158 yielding 5, 17, 21, 23, 25, . (keep odd number). - Gundala Viswanath Jakarta - Indonesia __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.