I have a data frame of this type
string1,string2,value1
string3,string1,value2
string3,string5,value3
...
...
I would convert srings in unique integers:
1,2,value1
3,1,value2
3,5,value3
...
...
I am trying with c() operator, that convert the string in a unique integer. The problem is how to manage the two columns of the data frame. How can I do this?
If you want to assign numbers to the strings, rather than removing the text ‘string’, you can use a factor with known levels, then coerce to numeric.
Note that the numeric values chosen do not agree with the numerals in the strings, but each string is given a unique number.