I have a matrix with: character class entries.
sapply(mat,class)
"character"
I would like to apply rowSums to this matrix but I get the error:
Error in rowSums(mat) : 'x' must be numeric
If I do as.numeric(mat) then I get a vector.
Is there a way to change from character to numeric but keep the matrix structure?
You could change the storage mode of your matrix: