0

I have a list I want to process to remove elements not meeting certain criteria. I'd use a loop but that is too slow so I assume lapply might be better.

assuming the last thing function y does is give a value of 1 or 2 to variable x how would I modify

lapply(list,functiony, z=valueA, a=valueB) to give back a list of only the elements of the list that are of value x=1?

A D
  • 195
  • 5
  • 20
  • 3
    Please show some example data and your expected results. It is not clear what `functiony` is. http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example – akrun Mar 26 '15 at 09:07
  • 3
    Maybe you could start showing us how you would proceed with a loop tp clarify what you want to do? – Dominic Comtois Mar 26 '15 at 09:17

1 Answers1

3

Try mylist[sapply(mylist, functiony, z=valueA, a=valueB)==1]

Rufo
  • 524
  • 1
  • 3
  • 18