[R] ASCII values to Decimal

Bansal, Vikas vikas.bansal at kcl.ac.uk
Sat Jul 9 01:36:39 CEST 2011


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?

Thanking you,
Warm Regards
Vikas Bansal
Msc Bioinformatics
Kings College London


More information about the R-help mailing list