R solution: Uses dplyr functions to group the data by user ID, then calculates the average rating for each user using summarize() and mean(). Returns a tibble with user ID and average rating.
MATLAB solution: Uses accumarray() to bin the ratings by user IDs, then calculates the mean rating within each bin. Returns a vector with average ratings for each unique user ID.
APL solution: Defines vectors for user IDs and ratings. Finds unique user IDs and indexes to bin ratings. Calculates average rating within each bin by summing product of ratings and indexes, then dividing by sum of indexes. Returns vectors of average ratings and unique user
Related topics: