Skip to content
Prev 345362 / 398502 Next

Creating a new column from a series of columns

Dear Dennis,

Assuming that your data.frame() is called dd, the following should get you
started:

colnames(dd[,-1])[apply(dd[,-1], 1, function(x) which(x == 'Yes'))]

HTH,
Jorge.-
On Sat, Nov 1, 2014 at 12:32 PM, Fisher Dennis <fisher at plessthan.com> wrote:

            

  
  
Message-ID: <CAKL8G3HcBJYh+6Arhyd4rsWmWAJTOPe=vnvjpDO82DjaSpGQAA@mail.gmail.com>
In-Reply-To: <FDB73B73-4EDA-43E7-A342-44ACA702768C@plessthan.com>