Trouble converting Values in Column into Row Names of Data Frame in R

59 Views Asked by At

I am trying to convert the first column of a data frame as Row names.

It works fine but the names of the data frame format changes!

It changes from like 100-21-0 to X100.21.0

First column is Character values: Code, CBT, DQY, DQX etc. and the names (or the first row?) of the data frame (double) like: Code, 100-21-0, 1002-84-2, 100-47-0 etc.

Code 100-21-0
CBT 0
DQY 1

I am using the code similar to:

newdataframe <- data.frame(dataframe, row.names = 1)

It works fine but the names of the data frame change from 100-21-0, 1002-84-2, 100-47-0 to X100.21.0, X1002.84.2, X100.47.0 !!!

I am confused why? Can anyone help on this?

0

There are 0 best solutions below