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.
我有一个数据框,t1它有两个字段names和rollno. 我想生成行名所在的数据框names。我怎样才能在 R 中做到这一点?
t1
names
rollno
你可以这样做:
a <- data.frame(name=c("A", "B"), b=1:2) b <- data.frame(a=1:2, b=1:2) row.names(b) <- a$name