I want to read the csv file as a matrix, and the matrix is numeric. The followwing is my code
1, read the data
mydata<-read.csv("mydata.csv", header = TRUE, sep=',', check.names = FALSE)
str(mydata)
2, transform as numeric data
mydata_1<-data.matrix(mydata)
str(mydata_1)
For the first step, the output is fine
but for the second step, when I want to transform the dataframe as a numeric matrix, the output is changed to be as follows. See that the rownames and the column names have been changed, and the cell values are also not true, which are not wanted.
I also tried the following syntax, but it produced the same result as above.
mydata_1<-sapply(mydata, as.numeric)
and here is the link of my data file link of mydata
Any suggestion is appreciated.