[datatable-help] Transform characters to numbers and compare
Arunkumar Srinivasan
aragorn168b at gmail.com
Sun Apr 13 21:43:17 CEST 2014
Please don't cross-post:
http://stackoverflow.com/questions/23047280/transform-characters-to-numbers
Arun
From: Sergio.pv serpalma.v at gmail.com
Reply: Sergio.pv serpalma.v at gmail.com
Date: April 13, 2014 at 9:36:35 PM
To: datatable-help at lists.r-forge.r-project.org datatable-help at lists.r-forge.r-project.org
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
datatable-help at lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/datatable-help/attachments/20140413/71872c65/attachment.html>
More information about the datatable-help
mailing list