Functions in dplyr generate errors such as Error in mutate_impl(.data, dots, caller_env()) : SET_VECTOR_ELT() can only be applied to a 'list', not a 'symbol'

The reprex() function runs the code you pass inside the function on a clean R session with an empty environment, nothing exists there, so you have to include library calls and definition of the sample data inside the code you pass to the function. To learn how to make a proper reprex, please take a look at this guide.