A matrix must have all numeric or all character values; otherwise, the numeric values will be converted to character and can't be used in calculations such as weighted sums.
Thank you very much for your answer @technocrat , but you can take a look at the resolution link, I believe the result is not the same. The idea of the exercise is to select the best candidate among 5 candidates using the weighted sum method. By the resolution, it is concluded that Student 4 is the best choice. But just using weightedSum doesn't tell me much, or something is missing that I haven't noticed yet.
That’s a different question from the one I thought was sought, which was to apply the weightSum() function to a data frame with all numeric values. The students are identified as alternatives and the remaining variables as weights. Fewer could be used or relative weights could be adjusted to give greater or lesser emphasis, a wider scale for grades could be adopted or changes could be made in combination. Whether and how to do so is a domain question rather than a computational one.