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 行:data[,3]。我的数据的第一列是行名。如何使用这些名称调用一行?我有很多数据集,它们都有不同的行顺序。
x <- data.frame( A = 1:10, B = 21:30 ) rownames( x ) <- sample( LETTERS, 10 ) i <- "H" > x A B J 1 21 A 2 22 I 3 23 G 4 24 H 5 25 B 6 26 P 7 27 Z 8 28 O 9 29 R 10 30 > x[ "H",] A B H 5 25 > x[ i,] A B H 5 25