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 の一連のポイントをプロットしようとしています。それらを色でサブグループ化したいと思います。例: 最初の 3 点で赤、次の 3 点で青、...
それぞれの色のベクトルを提供するだけです
plot(1:9, 1:9, col = c(rep("black", 3), rep("blue", 3), rep("red", 3)))
ただし、通常の状況では、これを手動で行うべきではなく、代わりにグループ化変数に従って色のベクトルを作成します。