I have a ddply
that goes over a list of IPs and applies a fun over each IP. I want the fun to return a value only if the nrow(ip.data) > 1
. Otherwise, I want ddply
to skip over that IP and continue. How can I do this?
eg:
pd.outs <- ddply(server_ips, .(ip), function(x) get.ip.outs(x$ip, data))
nrow(ip.data)
will provide the length of the number of rows in the subset of (data).
One way is to just return NULL
where nrow(x)==1
:
pd.outs <- ddply(server_ips, .(ip), function(x) {
if (nrow(x) == 1) {
return(NULL)
}
get.ip.outs(x$ip, data)
})