我想知道如何通过删除以下行从令人兴奋的数据框创建数据框:2、4、5、8 和 9
i want to know how to Create a data frame from exciting one by dropping the following rows: 2, 4, 5, 8, and 9
我尝试使用子集并尝试指定行,但它给了我数据框中的所有 11 行
examQual <- subset(examDF, nrow = c(2,4,5,8,9), select = c("name","score", "attempts", "qualify"))
如果你能帮助修复和解决这个问题
谢谢
第二个参数 (subset=
) 需要一个逻辑表达式,而不是整数。
这里有两种方法可以做你想做的事:
没有subset
:
examDF[c(2,4,5,8,9), c("name","score","attempts","qualify")]
和subset
,也许有点hackish:
subset(examDF, seq_len(nrow(examDF)) %in% c(2,4,5,8,9), select = c("name","score","attempts","qualify"))
我尝试使用子集并尝试指定行,但它给了我数据框中的所有 11 行
examQual <- subset(examDF, nrow = c(2,4,5,8,9), select = c("name","score", "attempts", "qualify"))
如果你能帮助修复和解决这个问题 谢谢
第二个参数 (subset=
) 需要一个逻辑表达式,而不是整数。
这里有两种方法可以做你想做的事:
没有
subset
:examDF[c(2,4,5,8,9), c("name","score","attempts","qualify")]
和
subset
,也许有点hackish:subset(examDF, seq_len(nrow(examDF)) %in% c(2,4,5,8,9), select = c("name","score","attempts","qualify"))