recode variables based on a table in excel

That line of code puts in a row number so that the original rows can be reconstructed with pivot_wider(). It would have made more sense to put the row number in earlier, like this:

library(dplyr)
library(tidyr)
DF <- read.csv("~/R/Play/Dummy.csv")
DF2 <- read.csv("~/R/Play/Dummy2.csv")
DFlong <- DF |> mutate(ROW=row_number()) |> 
  pivot_longer(cols = -ROW)
DFlong <- left_join(DFlong,DF2, by = c(value="Name1"))
DFWide <- DFlong |> select(-value) |> 
  pivot_wider(names_from = "name",values_from = "Name2")