[R] Retrieving lists of colnames

Vikash Kumar vikash.kr.117 at gmail.com
Thu Oct 16 07:05:55 CEST 2014


Hi Adam,

I guess below code would help you achieve the desired ouput.

> colnames(data[,which(apply(data,2,FUN = function(x){any(x>0.5)}))])

Happy Learning!

Vikash

On Wed, Oct 15, 2014 at 5:53 PM, Adam.N.Jenkins13 at gmail.com <
adam.n.jenkins13 at gmail.com> wrote:

>
>
> Hi what I have is a large excel doc (100 columns, 350 row) with data
> values from 0-10000. The end goal is for each row to have a list of
> colnames of which columns contain values >0. I've been tinkering around
> with apply mostly and some other functions, any help offered would be
> greatly appreciated.
> ______________________________________________
> 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]]



More information about the R-help mailing list