Yes a reprex
is important, and you were close! but there were some issues. Did you only have issues reading the file when trying to render the reprex
? If so, this is because reprex
can not read files from your computer. This is done, because if someone copies and pastes your code, they will not be able to read the file.
From there, everything else produced errors because the dataset did not exist. There are several ways to share data in a reprex
but unfortunately, reading them from a file is not one of them.
As for the code formatting, that is a separate thing. That is strictly an aesthetic thing to make your code readable on this site. If you render a reprex with the reprex
package than it should save the output to your clipboard which will be correctly formatted when you paste it here. However, if you copy and paste the output yourself than you will need to take care of the formatting as I mentioned in my previous comment!