Adding multiple vectors in R
r, vector
Solution
Here is another way, dropping NAs when sum the vectors:
df <- data.frame(vector1, vector2, vector3, vector4)
rowSums(df, na.rm=T)
Problem
I have a problem where I have to add thirty-three integer vectors of equal length from a dataset in R. I know the simple solution would be ``` Vector1 + Vector2 + Vector3 +VectorN ``` But I am sure there is a way to code this. Also some vectors have NA in place of integers so I need a way to skip those. I know this may be very basic but I am new to this.