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.
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.