How to replace the tag value with the corresponding actual value in R?

These are very different questions, we like to keep things tidy around here so just one reasonably well defined question per topic and closely related follow ups. Can you please ask these on new topicd providing a relevant REPRoducible EXample (reprex) for your new issue?