[R] subsetting of a data.frame

culpritNr1 ig2ar-saf1 at yahoo.co.uk
Thu May 21 18:23:06 CEST 2009


Hi Sarah and Jorge,

ncol(). How elegant!

Thank you.





Jorge Ivan Velez wrote:
> 
> Dear  culprit
> Try this:
> A[ , 4:ncol(A) ]
> 
> HTH,
> 
> Jorge
> 
> 
> 
> On Thu, May 21, 2009 at 12:06 PM, culpritNr1 <ig2ar-saf1 at yahoo.co.uk>
> wrote:
> 
>>
>> Hello everybody
>>
>> How do you subset a data.frame when your boundaries are a combination of
>> explicit and implicit limits?
>>
>> For example, I need to subset from the fourth (explicit) to the last
>> (implicit) column a data.frame named A.
>>
>> In other languages you would do A[ , 4:]. Would anybody show me the R's
>> way?
>>
>> Thank you,
>>
>> Your culprit
>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/subsetting-of-a-data.frame-tp23655883p23655883.html
>> Sent from the R help mailing list archive at Nabble.com.
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 
> 

-- 
View this message in context: http://www.nabble.com/subsetting-of-a-data.frame-tp23655883p23656179.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list