Hi,

I am wondering whether Stan allows subindexing a vector using logical expression like R. For example, suppose I have:

```
data{
int<lower = 0> N;
int<lower = 0> K;
vector<lower=0> [N] y;
vector<lower=0> [N] index; //eg (1, 1,1,2,2,3...)
}
```

Are we allowed to use expression like the following to select certain ys according an logical expression criteria? If not, do we have alternative expressions available in Stan?

```
generated quantities{
vector<lower = 0> [K] z;
}
for (i in 1 : K){
z[i] = sum(y[index == i]);
}
```

Thx!