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.
df1<- matrix(c(9,12000,72,"B1",7.6,8500,68,"B1",8.2,9500,63,"B2",8.5,10000,70,"A2",9.3,14000,72,"A2"),
nrow=5,
ncol=4,
byrow=TRUE)
row.names(df1) <- c("Student1","Student2","Student3","Student4","Student5")
colnames(df1) <- c("CGPA","Expected Stipend","Technical Exam Score","Aptitude Test Grade")
str(df1)
#> chr [1:5, 1:4] "9" "7.6" "8.2" "8.5" "9.3" "12000" "8500" "9500" "10000" ...
#> - attr(*, "dimnames")=List of 2
#> ..$ : chr [1:5] "Student1" "Student2" "Student3" "Student4" ...
#> ..$ : chr [1:4] "CGPA" "Expected Stipend" "Technical Exam Score" "Aptitude Test Grade"