Hi So perhaps doing neilist == pfriends is the same as doing neilist == rep(pfriends, 9)? neilist <- c(13, 15, 28, 29, 30, 13, 14, 15, 28, 30, 43, 44, 45, 14, 15, 29, 44, 45) pfriends <- c(13, 15)
cbind(neilist == pfriends, neilist == rep(pfriends, 9)) [,1] [,2] [1,] TRUE TRUE [2,] TRUE TRUE [3,] FALSE FALSE [4,] FALSE FALSE [5,] FALSE FALSE [6,] FALSE FALSE [7,] FALSE FALSE [8,] TRUE TRUE [9,] FALSE FALSE [10,] FALSE FALSE [11,] FALSE FALSE [12,] FALSE FALSE [13,] FALSE FALSE [14,] FALSE FALSE [15,] FALSE FALSE [16,] FALSE FALSE [17,] FALSE FALSE [18,] FALSE FALSE And try this neilist == c(13,14,15,30) [1] TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE [13] FALSE TRUE TRUE FALSE FALSE FALSE Warning message: In neilist == c(13, 14, 15, 30) : longer object length is not a multiple of shorter object length Yours sincerely / Med venlig hilsen Frede Aakmann Tøgersen Specialist, M.Sc., Ph.D. Plant Performance & Modeling Technology & Service Solutions T +45 9730 5135 M +45 2547 6050 fr...@vestas.com http://www.vestas.com Company reg. name: Vestas Wind Systems A/S This e-mail is subject to our e-mail disclaimer statement. Please refer to www.vestas.com/legal/notice If you have received this e-mail in error please contact the sender. > -----Original Message----- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf Of Rainer Schuermann > Sent: 18. marts 2014 12:42 > To: r-help@r-project.org > Subject: Re: [R] Which() missing a number > > ... and it is also missing the 15 at position 15. > > Can't explain but > > > which( neilist %in% pfriends ) > > should give you what you want. > > > > On Tuesday 18 March 2014 11:14:08 Thomas wrote: > > Does anyone know why this is happening? Which() is picking up the > > indices of the numbers 13 and 15 in neilist, but it's missing out the > > 13 at index 6. > > > > Thank you, > > > > Thomas Chesney > > > > > neilist > > [1] 13 15 28 29 30 13 14 15 28 30 43 44 45 14 15 29 44 45 > > > > > pfriends > > [1] 13 15 > > > > > which(neilist==pfriends) > > [1] 1 2 8 > > > > > neilist[6] > > [1] 13 > > > > > str(neilist) > > int [1:18] 13 15 28 29 30 13 14 15 28 30 ... > > > > > str(pfriends) > > num [1:2] 13 15 > > > > > sessionInfo() > > R version 2.15.3 (2013-03-01) > > Platform: i386-apple-darwin9.8.0/i386 (32-bit) > > > > locale: > > [1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF- > 8/en_GB.UTF-8 > > > > attached base packages: > > [1] splines grid stats graphics grDevices utils > > datasets methods > > [9] base > > > > other attached packages: > > [1] spdep_0.5-56 coda_0.16-1 deldir_0.0-21 maptools_0.8-23 > > foreign_0.8-52 > > [6] nlme_3.1-108 MASS_7.3-23 Matrix_1.0-11 lattice_0.20-13 > > boot_1.3-7 > > [11] sp_1.0-8 igraph_0.6.5-1 > > > > loaded via a namespace (and not attached): > > [1] LearnBayes_2.12 tools_2.15.3 > > > > This message and any attachment are intended solely for the addressee > and may contain confidential information. If you have received this message > in error, please send it back to me, and immediately delete it. Please do > not > use, copy or disclose the information contained in this message or in any > attachment. Any views or opinions expressed by the author of this email do > not necessarily reflect the views of the University of Nottingham. > > > > This message has been checked for viruses but the contents of an > attachment > > may still contain software viruses which could damage your computer > system, you are advised to perform your own checks. Email communications > with the University of Nottingham may be monitored as permitted by UK > legislation. > > > > ______________________________________________ > > 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. ______________________________________________ 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.