Home > Software engineering >  Storing every number that bigger than 600 to store another vector but is not printing numbers
Storing every number that bigger than 600 to store another vector but is not printing numbers

Time:01-28

I tried if vec2 > 600 save it to va

 set.seed(75)
 Vec2 <- sample(0:999, size = 100)

 print(Vec2)
 va <- (Vec2 > 600)
 print(va)

CodePudding user response:

set.seed(75)
Vec2 <- sample(0:999, size = 100)

print(Vec2)
#>   [1] 703 167 792 788 872 758 202 925 472 463 823 596 928 274 290 190 599 943
#>  [19] 321  95 745 587 971 635 432 300 818 415 878 914 139 926 806 677  49 832
#>  [37] 610 531 175 678 501 462 148 645 958 213 731 367 912 523 324  80 133 473
#>  [55] 235 976 595 239   1 785 591 533 908 750 455 946 435 384 223 510  97 853
#>  [73]  24 742 757 713 685 149 699 690 334 841 104 604 549 436 271 141 695 934
#>  [91] 129 932 561 439 296 897 174 727 445 396

va <- Vec2[(Vec2 > 600)]
print(va)
#>  [1] 703 792 788 872 758 925 823 928 943 745 971 635 818 878 914 926 806 677 832
#> [20] 610 678 645 958 731 912 976 785 908 750 946 853 742 757 713 685 699 690 841
#> [39] 604 695 934 932 897 727

Created on 2023-01-27 by the reprex package (v2.0.1)

  • Related