how to remove inf values from a vector r code example Example: r remove inf values df <- df[!is.infinite(rowSums(df)),]