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.
簡単なコードを次に示します。
for (i in c("red", "green")) for (j in c("blood", "trees")) { k <- paste(i, j, sep=" ") print(k) } }
"red blood"と のみを出力したいと思います"green trees"。残りの組み合わせは破棄されます。これはループ内で実現できますか?
"red blood"
"green trees"
そのためのループは必要ありません:
R> paste(c("red","green"), c("blood","trees")) [1] "red blood" "green trees"