Skip to content

subsetting of a data.frame

4 messages · culpritNr1, Sarah Goslee, Jorge Ivan Velez

#
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
#
You can for example use ncol(A) to get the number of columns.

Sarah
On Thu, May 21, 2009 at 12:06 PM, culpritNr1 <ig2ar-saf1 at yahoo.co.uk> wrote:

  
    
#
Hi Sarah and Jorge,

ncol(). How elegant!

Thank you.
Jorge Ivan Velez wrote: