首页 > 解决方案 > 根据行标签检索对应的列值

问题描述

所以我在excel中有一组数据:

StudID          Score            Participation

100              54                  0.43
432              70                  0.65
321              98                  0.96
100              65                  0.55

我将其读入 R:

stud_stat <- read.csv("student.csv")

我现在要做的是仅根据特定 ID 检索分数和参与值。例如,如果 ID 是 100,我会想要:

StudID          Score            Participation

 100             54                  0.43
 100             65                  0.55

我做了类似的事情:

find <- stud_stat[which(stud_stat$StudID == "100")]

我收到一个错误,提到undefined columns selected

标签: r

解决方案


推荐阅读