Please don't cross-post:
http://stackoverflow.com/questions/23047280/transform-characters-to-numbers

Arun

From: Sergio.pv [email protected]
Reply: Sergio.pv [email protected]
Date: April 13, 2014 at 9:36:35 PM
To: [email protected] 
[email protected]
Subject:  [datatable-help] Transform characters to numbers and compare  

I have a data.frame of two vectors.  

df <- data.frame(G1=c("b","a","e","d","c"),  
G2=c("c","d","e","b","a"))  
You can see that both vectors have the same characters, but in diferent  
order. I want to convert them into numbers and then compare them.  

To compare G2 to G1, G1 must be the reference, so the output will be this:  

df2 <- data.frame(G1=c("1","2","3","4","5"),  
G2=c("5","4","3","1","2"))  
Is there a way to do this?, thanks  



--  
View this message in context: 
http://r.789695.n4.nabble.com/Transform-characters-to-numbers-and-compare-tp4688708.html
  
Sent from the datatable-help mailing list archive at Nabble.com.  
_______________________________________________  
datatable-help mailing list  
[email protected]  
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help  
_______________________________________________
datatable-help mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help

Reply via email to