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.dany...@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@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.

Reply via email to