At Wednesday 03:50 AM 1/12/2005, [EMAIL PROTECTED] wrote:
Full_Name: Marc Mamin
Version: 1.8, 2.0.0
OS: Windows & Linux
Submission from: (NULL) (217.17.202.254)

[snipped issues previously responded to]

Here another example that underline how problematic this issue can be:

aa1<-1
aa2<-2
df<-as.data.frame(aa1,aa2)
> df$aa
[1] 1   (only the first matching column is retrieved)

Actually, the above commands constructed a data frame with one column (the second argument to 'as.data.frame' is 'row.names'):


> aa1<-1
> aa2<-2
> df <- as.data.frame(aa1,aa2)
> df
  aa1
2   1
> dim(df)
[1] 1 1

When a data frame (or list) does have columns whose names have common prefixes, the behavior is as documented (NULL is returned):

> df2 <- data.frame(aa1, aa2)
> df2
  aa1 aa2
1   1   2
> df2$aa
NULL
>

______________________________________________
R-devel@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to