Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想要在 R 中作为向量或矩阵生成的数据,我该怎么办?
> for(i in 1:100) { if(i%%5==0 && i%%8==5) print(i) } [1] 5 [1] 45 [1] 85
看起来你只是想这样做:
x <- 1:100 x[x %% 5 == 0 & x %% 8 == 5] # [1] 5 45 85