# R, When does the error "$operator is invalid for atomic vectors" occur? #### Jesmin ##### New Member Code: pmf <- array(c(2/15,1/15,4/15,1/15,3/15,4/15),dim=c(2,3), dimnames=list(X=1:2,Y=1:3)) pmf$Y
Error in pmf$Y :$ operator is invalid for atomic vectors
please give detail explanation. I have faced the problem a number of times not only for 'array' but also for 'data.frame'.

#### Dason

what exactly do you expect pmf$Y to return? #### Jesmin ##### New Member what exactly do you expect pmf$Y to return?
Rather i give another example:

Code:
b <- matrix(1:6,nrow=2,dimnames=list(c("X1","X2"),c("Y1","Y2","Y3")))
b
b$X1 or Code: pmf <- array(c(2/15,1/15,4/15,1/15,3/15,4/15),dim=c(2,3), dimnames=list(X=1:2,Y=1:3)) seq_along(pmf$Y)
Error in pmf$Y :$ operator is invalid for atomic vectors