我正在努力学习R但是我在理解这些数据结构时遇到了问题。我的印象是命名列表被索引 'listName $ index',但似乎有一些其他形式的命名列表。请看以下示例
> dput(someGame$players)
list(structure(list(match_id = c(10216L, 10216L, 10216L, 10216L
), player_slot = c(0L, 1L, 128L, 129L), account_id = c(86480929L,
86480927L, 86480949L, 86502042L), assists = c(0L, 0L, 2L, 5L),
deaths = c(4L, 7L, 1L, 2L), denies = c(3L, 1L, 1L, 20L),
gold = c(374L, 697L, 412L, 2408L), gold_per_min = c(186L,
217L, 401L, 319L), gold_spent = c(4324L, 4825L, 10865L, 6488L
), hero_damage = c(1270L, 2494L, 9157L, 4108L), hero_healing = c(0L,
0L, 0L, 0L), hero_id = c(6L, 20L, 15L, 26L), item_0 = c(0L,
0L, 29L, 23L), item_1 = c(0L, 0L, 125L, 29L), item_2 = c(0L,
0L, 41L, 10L), item_3 = c(0L, 0L, 162L, 104L), item_4 = c(0L,
0L, 0L, 16L), item_5 = c(0L, 0L, 22L, 0L), kills = c(0L,
2L, 9L, 2L), last_hits = c(36L, 31L, 73L, 64L), leaver_status = c(0L,
0L, 0L, 0L), level = c(9L, 11L, 14L, 14L), tower_damage = c(0L,
105L, 1977L, 2042L), xp_per_min = c(176L, 241L, 431L, 388L
), personaname = c("dotatournament", "dotatournament", "dotatournament",
"dotatournament"), radiant_win = c(FALSE, FALSE, FALSE, FALSE
), start_time = c(1313270783L, 1313270783L, 1313270783L,
1313270783L), duration = c(1626L, 1626L, 1626L, 1626L), cluster = c(0L,
0L, 0L, 0L), lobby_type = c(1L, 1L, 1L, 1L), game_mode = c(0L,
0L, 0L, 0L), patch = c(2L, 2L, 2L, 2L), isRadiant = c(TRUE,
TRUE, FALSE, FALSE), win = c(0L, 0L, 1L, 1L), lose = c(1L,
1L, 0L, 0L), total_gold = c(5040L, 5880L, 10867L, 8644L),
total_xp = c(4769L, 6531L, 11680L, 10514L), kda = c(0L, 0L,
5L, 2L), abandons = c(0L, 0L, 0L, 0L), benchmarks = structure(list(
gold_per_min = structure(list(raw = c(186L, 217L, 401L,
319L), pct = c(0.019338422, 0.124976543, 0.525310411,
0.635813457)), .Names = c("raw", "pct"), class = "data.frame", row.names = c(NA,
4L)), xp_per_min = structure(list(raw = c(176L, 241L,
431L, 388L), pct = c(0.032788077, 0.14374179, 0.478828399,
0.653969384)), .Names = c("raw", "pct"), class = "data.frame", row.names = c(NA,
4L)), kills_per_min = structure(list(raw = c(0, 0.073800738,
0.332103321, 0.073800738), pct = c(0.059764432, 0.443610433,
0.897738133, 0.311854753)), .Names = c("raw", "pct"), class = "data.frame", row.names = c(NA,
4L)), last_hits_per_min = structure(list(raw = c(1.328413284,
1.143911439, 2.693726937, 2.361623616), pct = c(0.056347244,
0.490335898, 0.430710417, 0.973774772)), .Names = c("raw",
"pct"), class = "data.frame", row.names = c(NA, 4L)),
hero_damage_per_min = structure(list(raw = c(46.863468635,
92.029520295, 337.896678967, 151.586715867), pct = c(0.027991857,
0.124225934, 0.641605607, 0.419247656)), .Names = c("raw",
"pct"), class = "data.frame", row.names = c(NA, 4L)),
hero_healing_per_min = structure(list(raw = c(0L, 0L,
0L, 0L), pct = c(0.989966555, 0.839744793, 0.848677923,
0.8167794)), .Names = c("raw", "pct"), class = "data.frame", row.names = c(NA,
4L)), tower_damage = structure(list(raw = c(0L, 105L,
1977L, 2042L), pct = c(0.0608506, 0.252204916, 0.760904171,
0.997389344)), .Names = c("raw", "pct"), class = "data.frame", row.names = c(NA,
4L))), .Names = c("gold_per_min", "xp_per_min", "kills_per_min",
"last_hits_per_min", "hero_damage_per_min", "hero_healing_per_min",
"tower_damage"), class = "data.frame", row.names = c(NA,
4L)), kills_per_min = c(NA, 0.073800738, 0.332103321, 0.073800738
)), .Names = c("match_id", "player_slot", "account_id", "assists",
"deaths", "denies", "gold", "gold_per_min", "gold_spent", "hero_damage",
"hero_healing", "hero_id", "item_0", "item_1", "item_2", "item_3",
"item_4", "item_5", "kills", "last_hits", "leaver_status", "level",
"tower_damage", "xp_per_min", "personaname", "radiant_win", "start_time",
"duration", "cluster", "lobby_type", "game_mode", "patch", "isRadiant",
"win", "lose", "total_gold", "total_xp", "kda", "abandons", "benchmarks",
"kills_per_min"), class = "data.frame", row.names = c(NA, 4L)))
所以someGame是一个命名列表,所以我们可以访问someGame $ player。但这也是一个清单。但是关注一些游戏$玩家$ kills_per_min,或者某些玩家玩家['kills_per_min']只返回NULL。
那么如何访问例如'kills_per_min'?
输出输出:
www.mywebsite.com/verification.php