Re: [R] dataframes with only one variable

2006-01-12 Thread Richard M. Heiberger
> df1 v1 1 1 2 2 3 3 4 4 > df1[,] [1] 1 2 3 4 > df1[,1] [1] 1 2 3 4 > df1[,,drop=F] v1 1 1 2 2 3 3 4 4 > df1[,1,drop=F] v1 1 1 2 2 3 3 4 4 > df1[1] v1 1 1 2 2 3 3 4 4 > df1[[1]] [1] 1 2 3 4 > For transfers from Excel to R using the "[put/get] R dataframe" commands, I thin

Re: [R] dataframes with only one variable

2006-01-12 Thread Prof Brian Ripley
On Wed, 11 Jan 2006, Erich Neuwirth wrote: > Subsetting from a dataframe with only one variable > returns a vector, not a dataframe. > This seems somewhat inconsistent. Not at all. It is entirely consistent with matrix-like indexing (the form you used). > Wouldn't it be better if subsetting wo

Re: [R] dataframes with only one variable

2006-01-12 Thread TEMPL Matthias
> Subsetting from a dataframe with only one variable > returns a vector, not a dataframe. > This seems somewhat inconsistent. > Wouldn't it be better if subsetting would respect > the structure completely? > > > v1<-1:4 > v2<-4:1 > df1<-data.frame(v1) > df2<-data.frame(v1,v2) > sel1<-c(TRUE,TRUE,

[R] dataframes with only one variable

2006-01-12 Thread Erich Neuwirth
Subsetting from a dataframe with only one variable returns a vector, not a dataframe. This seems somewhat inconsistent. Wouldn't it be better if subsetting would respect the structure completely? v1<-1:4 v2<-4:1 df1<-data.frame(v1) df2<-data.frame(v1,v2) sel1<-c(TRUE,TRUE,TRUE,TRUE) > df1[sel1,]