function Means = findMeans(X, R)
% function Means = findMeans(X, R)
%
% Finds mean vectors for data matrix X and mapping R

m = size(X, 2);
k = size(R, 2);

Means = zeros(k, m);
for i = 1:k
    Means(i,:) = mean(X(logical(R(:,i)),:));
end
