What is the equivalent of Julia R?

In R given by a vector x, one can find indices where its elements are TRUE. For instance. y = 1:100and which(is.even(y))should return 2,4, ..., 100

There is also which.max, and which.minwhich returns the index of the minimum and maximum values.

What are their equivalents in Julia?

+4
source share
2 answers

The function finddoes this.

In R:

y = c(1,2,3,4)    
which(y > 2)     

In Julia:

y = [1, 2, 3, 4]    
find(y .> 2)    
+6
source

There is a dictionary comparison list for Julia vs R; whichis on the list

http://www.johnmyleswhite.com/notebook/2012/04/09/comparing-julia-and-rs-vocabularies/

According to the list, Julia is findequivalent to R which, as claimed by others.

+1
source

Source: https://habr.com/ru/post/1691773/


All Articles