У меня есть блок данных компаний и отдельный блок данных с категориями, по которым я хочу оценить каждую из этих компаний; то, что я хочу сделать, это добавить мои данные категории данных в виде столбца данных данных компании, а затем unnest()
этот столбец. В конце я хочу создать файл excel / csv, который моя команда может использовать для отслеживания оценки компаний.
Вот мои данные:
companies <- tibble(company = c("company_a", "company_b", "company_c"))
# and here's the structure for my assessment criteria
structure(list(id = c(NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_), evaluator = c(NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_), subawardee_name = c(NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_),
category = c("category_1", "category_1", "category_1", "category_1",
"category_1", "category_2", "category_2", "category_2", "category_2",
"category_2", "category_3", "category_3", "category_3", "category_3",
"category_3", "category_4", "category_4", "category_4", "category_4",
"category_4"), level = c("Ownership", "Leadership", "Employees",
"Operations", "Product", "Ownership", "Leadership", "Employees",
"Operations", "Product", "Ownership", "Leadership", "Employees",
"Operations", "Product", "Ownership", "Leadership", "Employees",
"Operations", "Product"), rating = c(NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_), excerpt = c(NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_), source = c(NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_)), class = c("tbl_df",
"tbl", "data.frame"), row.names = c(NA, -20L))
Поэтому я хочу присоединиться к этому датафрейм в виде отдельной строки для каждой компании. Я пробовал это, но это не сработало:
companies %>%
group_by(company) %>%
mutate(data = assessment_criteria)
Error: Column `data` is of unsupported class data.frame
Я также пробовал различные объединения с комбинациями map_df
и map2_df
. Есть мысли здесь?