File size: 579 Bytes
f888423 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
box::use(
dplyr[filter]
)
box::use(
app/logic/utils[split_number, parse_recommendations]
)
#' @export
get_item_item_recommendations <- function(item_item_df, data_tab, ids, how_many) {
rows <- item_item_df |> filter(
book_id %in% ids
)
distribution <- split_number(how_many, length(ids))
result <- list()
for (i in 1:length(distribution)) {
result <- append(result, rows[i,which(colnames(item_item_df) == "X1"):distribution[i]] |> as.vector())
}
result <- result |> unlist()
return(parse_recommendations(result, data_tab, "ITEM-ITEM"))
}
|