[R] ASCII values to Decimal

Bansal, Vikas
Fri, 08 Jul 2011 23:36:39 -0000

Dear all,

I have a data frame which is like-

V1  V2               V3              V4
  9  2                 .,              a\
  9  2                .$,              a`
 13  1                  ,               a
 13  1                  ,               a
 13  1                  ,               a
 13  1                  ,               a
 13  1                  ,               `
 13  1                  ,               ^
 13  1                  ,               a
 13  1                 ,$               a

Column V4 contains ASCII values.I want to convert them into decimal.I am using-

df$V4=lapply(df[,4], function(c) as.numeric(charToRaw(c)))


I want to ask that,is this the right way to convert these values into decimal?