I think you have to return a as the result of the function.
When I apply the function on a simple case of sondage I get no errors. See below.
Therefore show us your input (or a simplified version of that): the most simple case that still gives the error.
tovector <- function(a) {
for(i in 1:(dim(a)[1])) {
b<-a[i,3]
b<-as.character(b)
b<-as.vector(el(strsplit(b,"\r\n")))
a[i,3]<-b
#a[i,11]<-as.vector(el(strsplit(as.character(a[i,11]),"\r\n")))
#a[i,14]<-as.vector(el(strsplit(as.character(a[i,14]),"\r\n")))
}
a
}
sondage <- matrix(data=1:18,ncol=6,byrow=T)
print(sondage)
#> [,1] [,2] [,3] [,4] [,5] [,6]
#> [1,] 1 2 3 4 5 6
#> [2,] 7 8 9 10 11 12
#> [3,] 13 14 15 16 17 18
tovector(sondage)
#> [,1] [,2] [,3] [,4] [,5] [,6]
#> [1,] "1" "2" "3" "4" "5" "6"
#> [2,] "7" "8" "9" "10" "11" "12"
#> [3,] "13" "14" "15" "16" "17" "18"
Created on 2022-05-10 by the reprex package (v2.0.1)