An a’b operation to get the dot product of two vectors returns missing' if either (or both) vector has
missing’ elements. There doesn’t seem to be a simple way to join a and b, do the equivalent of an na.omit() on the structure and then do the dot product operation on the remaining vectors. What am I `missing’?
Welcome to the forum @Susan.Thomas! The skipmissing
function is generally what you want to use when summarizing or reducing over a vector with missing elements. In this case, you could do:
sum(skipmissing(a .* b))
1 Like
That worked. Thanks much. Will explore skipmissing() further.