Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 206278

skipping NULL output in apply

$
0
0

When using apply in R, is there some way to have it skip over vector elements that are NULL, such that when f(x2,y2) is undefined apply(x,1,f,y) returns

c(f(x1,y1),f(x1,y2),f(x2,y2))
rather than
c(f(x1,y1),f(x1,y2),NULL,f(x2,y2))?


Viewing all articles
Browse latest Browse all 206278

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>