#1 データの読み込み

PCA_data <- read.table("/Users/iden/2025_kadai/plink_results_projected.sscore", header = TRUE, comment.char = "")
PED_data <- read.table("/Users/iden/2025_kadai/integrated_call_samples_v3.20130502.ALL.panel", header = TRUE)

#2 上の二つのデータを結合

merged_data <- merge(PCA_data, PED_data, by.x = "IID", by.y = "sample", all.x = TRUE)

#3 プロットの作成

PCA_plot <- ggplot(merged_data, aes(x = PC1_AVG, y = PC2_AVG, color = pop)) +
geom_point()

PCA_plot