Message-ID: <CA+8X3fW8JmeQPQD4+sFX4hDiw9UCnLhsibPPjnrP0Bk+q+gDkQ@mail.gmail.com>
Date: 2019-03-03T06:43:12Z
From: Jim Lemon
Subject: Remove Even Number from A Vector
In-Reply-To: <YQXPR01MB2743BF5157B0C75811B6587498770@YQXPR01MB2743.CANPRD01.PROD.OUTLOOK.COM>
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 <Darren.Danyluk at sd6.bc.ca> 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 at 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.