1

我无法从对象中提取行名。当我输入 rownames(object) 时,我得到“null”,但如果我输入 object,我得到信息矩阵。如果有帮助,当我输入类(对象)时,它会告诉我它是一个列表。我正在寻找的是一种获取侧面行名的方法。谢谢!

>

        alpha84 alpha91 alpha98 alpha105 alpha112 alpha119
YBR088C    1.08    0.27    0.04    -0.51    -0.80    -0.89
YDL003W    0.62   -0.01   -0.36    -0.04    -0.55    -0.55
YDR097C    0.64    0.18   -0.05     0.03    -0.76    -0.66
YDR507C    0.53    0.13    0.07     0.14    -0.56    -0.41
YER070W    0.73    0.20    0.00     0.11    -0.53    -0.72
YER095W    0.28   -0.05   -0.11    -0.13    -0.87    -0.90
YER111C    0.37   -0.19   -0.11    -0.54    -0.34    -0.47
YGR189C    0.81    0.12    0.15    -0.39    -0.60    -1.20
YKL045W    0.46   -0.27   -0.10    -0.23    -0.42    -1.21
YLR183C    0.96    0.14    0.28    -0.17    -0.14    -0.68
YML027W    0.50   -0.01    0.11    -0.33    -0.44    -0.94
YMR179W    0.42    0.04   -0.40    -0.47    -0.12    -0.61
YNL300W    0.79    0.33    0.54    -0.09    -0.31    -1.01
YOR074C    0.73    0.09   -0.27    -0.22    -0.62    -0.80
YPL163C    1.61    0.84    0.82    -0.09    -0.48    -0.97
YPL256C    1.10    0.56    0.18    -0.32    -0.38    -1.04

结构(列表(4=结构(列表(alpha0 = c(-1.15,-1.22,-0.72,-1.76,-1.46,-0.57,-1.21,-0.32,-0.8,-1.7,-1.72,-1.3,-1.24,-1.14 , -2.42, -1.41), alpha7 = c(-0.86, -0.74, -0.85, -0.34, -0.76, 0.42, -0.26, -0.65, 0.01, -1.46, -0.66, 0.07, -0.78, -0.31 , -2.15, -0.69), alpha14 = c(1.21, 1.34, 0.54, 0.18, 1.08, 1.03, 1.36, 0.87, 0.86, 0.93, 1.73, 0.98, 0.31, 0.57, 0.66, 1.39 ), alpha21 = c(1.39) , 1.5, 1.04, 1.07, 1.5, 1.35, 1.37, 1.1, 0.84, 1.12, 1.29, 1.12, 1.46, 1.08, 1.98, 1.98), alpha28 = c(1.12, 0.63, 0.84, 0.47, 0.5, 0.4, 0.5, 0 1.17, 0.51, 0.91, 0.51, 0.13, 1.11, 1.17, 1.55, 0.74), alpha35 = c(0.16, 0.29, 0.24, 0.32, 0.47, 0.42, 0.18, 0.44, 0.14, 0.171, 0.6,8, 0.571, 0.6,8, , 0.78, 0.21), alpha42 = c(-0.44, -0.55, -0.64, -0.5, -0.7, -0.4, -0.85, 0.37, -0.4, 0, 0.23, -0.58, 0.07, 0.31, 0.14, - 0.36), alpha49 = c(-0.93,-0.65, -0.83, -0.25, -0.68, -0.9, -0.82, -0.93, -0.64, -0.73, -0.55, -0.63, -0.23, -0.74, -0.94, -1.32), alpha56 = c( -1.23, -0.76, -0.36, -0.48, -1.03, -0.73, -0.75, -1.45, -0.8, -0.9, -0.97, -0.9, -0.58, -0.68, -1.03, -1.5), alpha63 = c(-0.62, -0.88, -0.7, -0.25, -0.55, -0.47, 0.07, -0.57, 0.41, -0.46, -0.48, 0.09, -1.01, -0.1, -1.5, -1.07), alpha70 = c(0.62, 0.69, 0.99, 0.79, 0.35, 0.2, 0.89, 0.15, 0.88, 0.85, 0.57, 0.54, -0.24, -0.38, -0.03, 0.35), alpha77 = c(1.3, 1.25, 1.08, 0.97 , 1.24, 0.78, 0.78, 0.92, 0.75, 0.93, 0.88, 1.44, 0.23, 0.75, 1.25, 1.57), alpha84 = c(1.08, 0.62, 0.64, 0.53, 0.73, 0.28, 6, 0.37, 0.9, 0.8 0.5, 0.42, 0.79, 0.73, 1.61, 1.1), alpha91 = c(0.27, -0.01, 0.18, 0.13, 0.2, -0.05, -0.19, 0.12, -0.27, 0.14, -0.01, 0.04, 0.33, 0.09, 0.84, 0.56), alpha98 = c(0.04,-0.36, -0.05, 0.07, 0, -0.11, -0.11, 0.15, -0.1, 0.28, 0.11, -0.4, 0.54, -0.27, 0.82, 0.18), alpha105 = c(-0.51, -0.04, 0.03, 0.14, 0.11, -0.13, -0.54, -0.39, -0.23, -0.17, -0.33, -0.47, -0.09, -0.22, -0.09, -0.32), alpha112 = c(-0.8, -0.55, -0.76 , -0.56, -0.53, -0.87, -0.34, -0.6, -0.42, -0.14, -0.44, -0.12, -0.31, -0.62, -0.48, -0.38), alpha119 = c(-0.89, -0.55 , -0.66, -0.41, -0.72, -0.9, -0.47, -1.2, -1.21, -0.68, -0.94, -0.61, -1.01, -0.8, -0.97, -1.04)), .Names = c( “alpha0”、“alpha7”、“alpha14”、“alpha21”、“alpha28”、“alpha35”、“alpha42”、“alpha49”、“alpha56”、“alpha63”、“alpha70”、“alpha77”、“alpha84” ", "alpha91", "alpha98", "alpha105"、"alpha112"、"alpha119")、row.names = c("YBR088C"、"YDL003W"、"YDR097C"、"YDR507C"、"YER070W"、"YER095W"、"YER111C"、"YGR189C"、 “YKL045W”、“YLR183C”、“YML027W”、“YMR179W”、“YNL300W”、“YOR074C”、“YPL163C”、“YPL256C”),类 = “data.frame”)),.Names = “4”)“YPL163C”、“YPL256C”)、类 = “data.frame”))、.Names = “4”)“YPL163C”、“YPL256C”)、类 = “data.frame”))、.Names = “4”)

4

1 回答 1

5

你有list一个元素。这个单一元素是一个data.frame.

如果您在rownames从此对象之后,则适当地索引列表

rownames(object[[1]])
## [1] "YBR088C" "YDL003W" "YDR097C" "YDR507C" "YER070W" "YER095W" "YER111C" "YGR189C" "YKL045W" "YLR183C" "YML027W"
## [12] "YMR179W" "YNL300W" "YOR074C" "YPL163C" "YPL256C"

有关 data.frames 的更一般列表

# get rownames from all data.frames in a list
lapply(object, rownames)

如果你想要一个 data.frame,而不是一个包含 data.frame 的列表,那么你可以简单地将第一个元素的结果分配给一个单独的元素

object.df <- object[[1]]

如果它是 data.frames 的列表,则将其R保留在列表中并用于lapply处理每个元素可能更惯用。

于 2013-04-14T23:47:47.900 回答