Имеется функция foo
, которая выводит список из 3 кадров данных:
structure(list(isSameUser = structure(1:2, .Label = c("0", "1"
), class = "factor"), n = c(212L, 72L), cum_n = c(212L, 284L),
user_id = c(1, 1)), .Names = c("isSameUser", "n", "cum_n",
"user_id"), class = c("tbl_df", "tbl", "data.frame"), row.names = c(NA,
-2L))
structure(list(isSameUser = structure(1:2, .Label = c("0", "1"
), class = "factor"), n = c(54L, 18L), cum_n = c(54L, 72L), user_id = c(1,
1)), .Names = c("isSameUser", "n", "cum_n", "user_id"), class = c("tbl_df",
"tbl", "data.frame"), row.names = c(NA, -2L))
structure(list(error_abs_perc = 0.0694444444444444, user_id = 1), .Names = c("error_abs_perc",
"user_id"), class = c("tbl_df", "tbl", "data.frame"), row.names = c(NA,
-1L))
У меня 1000 пользователей ----> это означает, что у меня есть 1000 * 3 фреймов данных, 1000 из первого, 1000 из второго и 1000 из третьего.
Посоветуйте, пожалуйста, как я могу map_dfr
это сделать и получить 3 связанных кадра данных.
Я пытаюсь сделать это, используя imap_dfr
и map_dfr
.
пробовал это:
Использование Dplyr :: Bind_Rows и Purrr для выборочного связывания разных фреймов данных в списке фреймов
Но это не решает мою проблему.
За запрос @markus:
list(structure(list(train_stats = structure(list(isSameUser = structure(1:2, .Label = c("0",
"1"), class = "factor"), n = c(212L, 72L), cum_n = c(212L, 284L
), user_id = c(1L, 1L)), .Names = c("isSameUser", "n", "cum_n",
"user_id"), class = c("tbl_df", "tbl", "data.frame"), row.names = c(NA,
-2L)), test_stats = structure(list(isSameUser = structure(1:2, .Label = c("0",
"1"), class = "factor"), n = c(54L, 18L), cum_n = c(54L, 72L),
user_id = c(1L, 1L)), .Names = c("isSameUser", "n", "cum_n",
"user_id"), class = c("tbl_df", "tbl", "data.frame"), row.names = c(NA,
-2L)), test_set_error = structure(list(error_abs_perc = 0.0694444444444444,
user_id = 1L), .Names = c("error_abs_perc", "user_id"), class = c("tbl_df",
"tbl", "data.frame"), row.names = c(NA, -1L))), .Names = c("train_stats",
"test_stats", "test_set_error")), structure(list(train_stats = structure(list(
isSameUser = structure(1:2, .Label = c("0", "1"), class = "factor"),
n = c(238L, 46L), cum_n = c(238L, 284L), user_id = c(2L,
2L)), .Names = c("isSameUser", "n", "cum_n", "user_id"), class = c("tbl_df",
"tbl", "data.frame"), row.names = c(NA, -2L)), test_stats = structure(list(
isSameUser = structure(1:2, .Label = c("0", "1"), class = "factor"),
n = c(60L, 12L), cum_n = c(60L, 72L), user_id = c(2L, 2L)), .Names = c("isSameUser",
"n", "cum_n", "user_id"), class = c("tbl_df", "tbl", "data.frame"
), row.names = c(NA, -2L)), test_set_error = structure(list(error_abs_perc = 0.0555555555555556,
user_id = 2L), .Names = c("error_abs_perc", "user_id"), class = c("tbl_df",
"tbl", "data.frame"), row.names = c(NA, -1L))), .Names = c("train_stats",
"test_stats", "test_set_error")), structure(list(train_stats = structure(list(
isSameUser = structure(1:2, .Label = c("0", "1"), class = "factor"),
n = c(232L, 52L), cum_n = c(232L, 284L), user_id = c(3L,
3L)), .Names = c("isSameUser", "n", "cum_n", "user_id"), class = c("tbl_df",
"tbl", "data.frame"), row.names = c(NA, -2L)), test_stats = structure(list(
isSameUser = structure(1:2, .Label = c("0", "1"), class = "factor"),
n = c(58L, 14L), cum_n = c(58L, 72L), user_id = c(3L, 3L)), .Names = c("isSameUser",
"n", "cum_n", "user_id"), class = c("tbl_df", "tbl", "data.frame"
), row.names = c(NA, -2L)), test_set_error = structure(list(error_abs_perc = 0.0138888888888889,
user_id = 3L), .Names = c("error_abs_perc", "user_id"), class = c("tbl_df",
"tbl", "data.frame"), row.names = c(NA, -1L))), .Names = c("train_stats",
"test_stats", "test_set_error")), structure(list(train_stats = structure(list(
isSameUser = structure(1:2, .Label = c("0", "1"), class = "factor"),
n = c(224L, 60L), cum_n = c(224L, 284L), user_id = c(4L,
4L)), .Names = c("isSameUser", "n", "cum_n", "user_id"), class = c("tbl_df",
"tbl", "data.frame"), row.names = c(NA, -2L)), test_stats = structure(list(
isSameUser = structure(1:2, .Label = c("0", "1"), class = "factor"),
n = c(56L, 16L), cum_n = c(56L, 72L), user_id = c(4L, 4L)), .Names = c("isSameUser",
"n", "cum_n", "user_id"), class = c("tbl_df", "tbl", "data.frame"
), row.names = c(NA, -2L)), test_set_error = structure(list(error_abs_perc = 0.0694444444444444,
user_id = 4L), .Names = c("error_abs_perc", "user_id"), class = c("tbl_df",
"tbl", "data.frame"), row.names = c(NA, -1L))), .Names = c("train_stats",
"test_stats", "test_set_error")), structure(list(train_stats = structure(list(
isSameUser = structure(1:2, .Label = c("0", "1"), class = "factor"),
n = c(232L, 52L), cum_n = c(232L, 284L), user_id = c(5L,
5L)), .Names = c("isSameUser", "n", "cum_n", "user_id"), class = c("tbl_df",
"tbl", "data.frame"), row.names = c(NA, -2L)), test_stats = structure(list(
isSameUser = structure(1:2, .Label = c("0", "1"), class = "factor"),
n = c(58L, 14L), cum_n = c(58L, 72L), user_id = c(5L, 5L)), .Names = c("isSameUser",
"n", "cum_n", "user_id"), class = c("tbl_df", "tbl", "data.frame"
), row.names = c(NA, -2L)), test_set_error = structure(list(error_abs_perc = 0.0138888888888889,
user_id = 5L), .Names = c("error_abs_perc", "user_id"), class = c("tbl_df",
"tbl", "data.frame"), row.names = c(NA, -1L))), .Names = c("train_stats",
"test_stats", "test_set_error")))