Skip to content
Prev 301960 / 398502 Next

Error message: $ operator is invalid for atomic vectors

Hi Rui,

Thanks.? It was my fault.? I had both of these saved (read.table (), data.frame(read.table()).? I think I accidentally pasted the second one, and got the error.? 


A.K.



----- Original Message -----
From: Rui Barradas <ruipbarradas at sapo.pt>
To: arun <smartpink111 at yahoo.com>
Cc: r-help <r-help at r-project.org>
Sent: Wednesday, August 1, 2012 9:41 AM
Subject: Re: Error message: $ operator is invalid for atomic vectors

Hello,

Because there's a bug in the way I read the data: data.matrix is not 
well used here, it transforms all variables in character vectors and may 
cause problems such as
[1] FALSE
[1] TRUE

It was David Winsemius that pointed this out.
As a side effect, data.matrix returns a matrix so '$' is invalid.
Use read.table and both codes are equivalent.

Rui Barradas

Em 01-08-2012 14:28, arun escreveu: