replace values in string with matching values from another string

You can use match for that:

lf[match(plainte, names(lf))]

To calculate the sum:

sum(lf[match(plainte, names(lf))])

which gives:

[1] 2.79333

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top