Fast fingers. Had to change the test:
> vlarge <- c(numeric(20),1:20)
> system.time(
+ for (i in 1:3) {
+which.min(!(vlarge != 0))}) # test changed
user system elapsed
0.350.000.42
>
> #Method 2:
> system.time(
+ for (i in 1:3) {
+ for (i in 1:40) {
+ if (vlarge[
try .which.mine
Here is what is does on my system:
> vlarge <- c(numeric(20),1:20)
> system.time(
+ for (i in 1:3) {
+which.min(vlarge != 0)})
user system elapsed
0.300.000.35
>
> #Method 2:
> system.time(
+ for (i in 1:3) {
+ for (i in 1:40) {
+ if (vlarge[i] != 0
2 matches
Mail list logo