[R] Creating subset using selected columns

2013-06-16 Thread Suparna Mitra
Hello R experts, I need a help to create a subset file. I know with subset comand, its very easy to select many different columns, or threshold. But here I have a bit problem as in my data file is big. And I don't want to identify the column numbers or names manually. I am trying to find any

Re: [R] Creating subset using selected columns

2013-06-16 Thread Rui Barradas
Hello, You could try something like the following. The example below assumes your data.frame is named 'dat' cnums - grep(Peak\\.Area, colnames(dat)) subdat - dat[cnums] See ?regexp for the regular expressions used by ?grep. Hope this helps, Rui Barradas Em 16-06-2013 08:20, Suparna Mitra

Re: [R] Creating subset using selected columns

2013-06-16 Thread Rainer Schuermann
Supposed your data.frame is called x, try x[ which( substr( colnames( x ), 1, 4 ) == Peak ) ] On Sunday 16 June 2013 15:20:37 Suparna Mitra wrote: Hello R experts, I need a help to create a subset file. I know with subset comand, its very easy to select many different columns, or threshold.