[R] Invalid Type of Char Argument When Sum() is Used

Gundala Viswanath gundalav at gmail.com
Fri Mar 13 09:37:43 CET 2009

Hi all,

I have the following data

AAA  1e+06 1222.312
AAC  100.2  0.33

However the following command

dat <- read.table("mydat.txt");


n1 <- sum(as.matrix(dat$V1));

Error in sum(as.matrix(dat$V1)) : invalid 'type' (character) of argument

What's wrong with the data type so that it gives such error?

- Gundala Viswanath
Jakarta - Indonesia

More information about the R-help mailing list