All, I'm having a problem selecting directly from a vector. I've written ways to do this indirectly, but I'd rather do it directly and didn't see this in the manual. Essentially, I have:> group.label.new[1] 7 9 6 1 10 4 8 3 2 5> junk[1] 1 2> group.label.new[junk && 8:10][1] 7 9 6 1 10 4 8 3 2 5 I'd like to select the elements indexed by "junk" and also the 8th through 10th elements, which clearly isn't the result I'm getting. Any help appreciated, and please reply directly to afshar@miami.edu cheers, dave [[alternative HTML version deleted]]
Hi, how about group.label.new[c(junk,8:10)] Nolwenn ************************************** Nolwenn Le Meur, PhD Fred Hutchinson Cancer Research Center Computational Biology 1100 Fairview Ave. N., M2-B876 P.O. Box 19024 Seattle, WA 98109-1024 On Fri, 7 Oct 2005, Afshartous, David wrote:> > > All, > I'm having a problem selecting directly from a vector. I've written ways to do this > indirectly, but I'd rather do it directly and didn't see this in the manual. > > Essentially, I have: > > > group.label.new > [1] 7 9 6 1 10 4 8 3 2 5 > > junk > [1] 1 2 > > group.label.new[junk && 8:10] > [1] 7 9 6 1 10 4 8 3 2 5 > > I'd like to select the elements indexed by "junk" and also the 8th through 10th elements, which > clearly isn't the result I'm getting. Any help appreciated, and please reply directly to > afshar at miami.edu > > cheers, > dave > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html >
Thanks for those on the list that answered my previous question. I'm just about where I need to be (looking at output). In the hier.part documentation there is a line env <- urbanwq[,2:8]. This means use rows 2 through 8 in the data frame "urbanwq", right? What does the comma represent? If one wasn't using column headers would this be necessary? Thanks, Jeff **************************************** Jeffrey A. Stratford, Ph.D. Postdoctoral Associate 331 Funchess Hall Department of Biological Sciences Auburn University Auburn, AL 36849 334-329-9198 FAX 334-844-9234 http://www.auburn.edu/~stratja
======= 2005-11-02 05:13:45 伳侜佋佢伬伌佇伵佒佇佇伌伒伬仯伜======>Thanks for those on the list that answered my previous question. I'm >just about where I need to be (looking at output). > >In the hier.part documentation there is a line env <- urbanwq[,2:8]. > >This means use rows 2 through 8 in the data frame "urbanwq", right?his means use columns 2 through 8 in the data frame "urbanwq">What does the comma represent?It means the first argument to function "[" is left blank,so makes R knows 2:8 is the second argument to "[".> If one wasn't using column headers would >this be necessary?It still is necessary.> >Thanks, > >Jeff > > > >**************************************** >Jeffrey A. Stratford, Ph.D. >Postdoctoral Associate >331 Funchess Hall >Department of Biological Sciences >Auburn University >Auburn, AL 36849 >334-329-9198 >FAX 334-844-9234 >http://www.auburn.edu/~stratja > >______________________________________________ >R-help at stat.math.ethz.ch mailing list >https://stat.ethz.ch/mailman/listinfo/r-help >PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html= = = = = = = = = = = = = = = = = = = 2005-11-02 ------ Deparment of Sociology Fudan University My new mail addres is ronggui.huang at gmail.com Blog:http://sociology.yculblog.com