Hi,
----- Original Message ----- 
From: "Ajay Shah" <[EMAIL PROTECTED]>
>
> But this doesn't work since if D is a data frame, you can't say
> D[d]. Let me show you:
>
> > x = runif(100)
> > y = runif(100)
> > D = data.frame(x, y)
> > d = c(7,3,2)
> > E = D[d]
> Error in "[.data.frame"(D, d) : undefined columns selected
>
> Any suggestions on how one can do such pretty things as D[d] where D
> is a data frame?

So I take it you want to select the 7th, 3rd, and 2nd observation (i.e.
rows) from D?

A data frame has two dimensions, so you need to specify the row and columns.
Maybe try:
  E = D[d,]

HTH,

Kevin Wang

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to