viewof scores = Inputs.table(
pca
.predict(asMatrix(food_scaled))
.toJSON()
.map((row, rowIndex) => {
const columns = Object.keys(food_scaled[rowIndex]);
const rowObj = {
Name: food[rowIndex].Name
};
columns.forEach((column, colIndex) => {
rowObj[`PC${colIndex + 1}`] = row[colIndex];
});
return rowObj;
})
)