V <- c(1,3,2,4,2,3,1); X <- 3; pos <-V[V == X];
pos 3 3 . I need all 3 positions;
pos
3 3
I need 2 and 6 ; which are positions 3 in V .
2
6
3
V
Use which
which
pos <- which(V == 3)
Not what you are asking for, but useful anyway: you can also use which.min and which.max to find the position of the minimum and maximum values โโof the array.
which.min
which.max
Source: https://habr.com/ru/post/890340/More articles:Environment variables are in char *, how to get it in std :: string - c ++Form Authentication Error: Rendering or Redirecting? - validationWhy does the template not display a special Playframework authentication message - java32-bit variable overflow - cGet month numbers for the current quarter - ruby โโ| fooobar.comOne-Time Password (OTP) Converting C # Code to Java - javaHow can I add and remove files from an ISO image? - delphiJava download speed measurement - javaIs there a processing tool profiler available? - profilerHow to return (custom) SOAPFault from Axis web service? - javaAll Articles