Hi shan gao,

On 11-09-22 10:49 AM, wang peter wrote:
    Hervé Pagès:

    thank you very much

    i think it is equal to the %in%

Not exactly. Using %in% ignores the order in which you are
supplying your ids:

  > x <- c(a=1, b=2, c=3)
  > myids <- c("c", "a")
  > x[names(x) %in% myids]  # NOT equivalent to x[myids]
  a c
  1 3
  > x[match(myids, names(x))]  # equivalent to x[myids]
  c a
  3 1

H.


shan gao


--
Hervé Pagès

Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M1-B514
P.O. Box 19024
Seattle, WA 98109-1024

E-mail: hpa...@fhcrc.org
Phone:  (206) 667-5791
Fax:    (206) 667-1319

_______________________________________________
Bioc-sig-sequencing mailing list
Bioc-sig-sequencing@r-project.org
https://stat.ethz.ch/mailman/listinfo/bioc-sig-sequencing

Reply via email to