[R] How to slice the array?

Alice @||ce @end|ng |rom co@km@||@com
Sun Oct 31 08:21:38 CET 2021

How to slice the array with the condition?
For example, in perl I can get the elements greater than 2.

$ perl -le '@x=(1,2,3,4,5);@y=grep {$_>2} @x;print "@y"'

3 4 5

in R I know which(x>2), but it will return the indexes instead of an array.

Thanks again.


	[[alternative HTML version deleted]]

More information about the R-help mailing list