[R] How to avoid "$ operator is invalid for atomic vectors"

cruz cruadam at gmail.com
Thu Nov 6 17:22:42 CET 2008


Hi,

I am writing this in a wrong way, can someone please correct me?

> A <- matrix()
> length(A) <- 6
> dim(A) <- c(3,2)
> colnames(A) <- c("X","Y")
> A
      X  Y
[1,] NA NA
[2,] NA NA
[3,] NA NA
> A$X
Error in A$X : $ operator is invalid for atomic vectors
>

Thanks,
cruz



More information about the R-help mailing list