Can you cut the data.frame down to just 2 rows and 2 columns that display the error? You might find the error in the process of doing that. If not, you should be able to distribute your same question with an example so anyone else can reproduce the problem.

This doesn't answer your question, but this technique can be used to resolve many difficult problems.

spencer graves

Ryan Thomas Moore wrote:
I can create a small dataset, "x" below, and subset out rows based on values of a certain variable. However, on the dataset I'm working on now, "latdata" below, I get a subscript error. Any advice is appreciated!

Ryan


Successful:



is.data.frame(x)

[1] TRUE


x

X1 X2 X3 1 1 3 5 2 2 4 6

x[x$X2 %in% c(3),]

X1 X2 X3 1 1 3 5

Unsuccessful:


is.data.frame(latdata)

[1] TRUE


is.numeric(latdata$intent)

[1] TRUE


table(latdata$intent)


1 2 3 4 5 6 34 23 67 179 996 2

unlikely <- latdata[latdata$intent %in% c(1,2,3,4),]

Error in x[[j]] : subscript out of bounds



------------------------------------------ Ryan T. Moore ~ Government & Social Policy Ph.D. Candidate ~ Harvard University

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to