How to convert a character matrix to a numeric data.frame in R? : I have a character matrix and a character data.table. When I merge them a data.frame is created but the character classes all converted to factors which I wanted to avoid. Is there a way to avoid it?

    df.new<-merge(matrix, df, by= col1)

I tried to turn the character matrix to numeric beforehand but then I lost the dimensions of the matrix.

    num.matrix<- sapply(matrix, as.numeric)

Is there a neat way to handle such a situation?
    