HI,
I was talking about another method to get the same result: myVector[1:100%%2==1] identical(myVector[1:100%%2==1],myVector[seq(1,100,by=2)]) #[1] TRUE Hope it helps. A.K. ________________________________ From: Zsurzsa Laszlo <zsurzsalas...@gmail.com> To: arun <smartpink...@yahoo.com> Cc: R help <r-help@r-project.org> Sent: Wednesday, August 28, 2013 5:21 AM Subject: Re: [R] R Language Newbie Can you specify you're task? I don't understand totally what you need to do? You're already getting odd numbers with : seq(1,100,by=2) -------------------------------------------------------------------------------------- László-András Zsurzsa, - - Msc. Infromatics, Technical University Munich, Germany - - Scientific Employee, TUM - ------------------------------------------------------------------------------------- On Wed, Aug 28, 2013 at 12:18 AM, arun <smartpink...@yahoo.com> wrote: Hi, >set.seed(29) > >myVector<- rnorm(100) > seq(1,100,by=2) ># [1] 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 >49 >#[26] 51 53 55 57 59 61 63 65 67 69 71 73 75 77 79 81 83 85 87 89 91 93 95 97 >99 > > >myVector[seq(1,100,by=2)] > > >rev(myVector) > > sum(myVector>0) >#[1] 46 >#or > > table(myVector>0) ># >#FALSE TRUE > # 54 46 > > > >A.K. > > > >Hey guys, this is my first week taking R language courses and I'm having >trouble with this assignment. I think I got the hang of it to an extent but >was wondering if I could get help on one tiny part of my >assignment. > >How can I get odd numbers from the vector I've created? To show >you guys I've done the majority of my homework by myself I've included >screenshots. > >______________________________________________ >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-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.