Problems with 'select' function, unknown column rlang error appears

EDIT: to be precise, kndrtt correctly used the reprex package. However, using the reprex package helps creating a reproducible example, but unfortunately it's not enough. This is a difficult point to convey, and something which I myself struggled with when, some years ago, I started using Stack Overflow, when the reprex package didn't actually exist, but people were (and of course still are) expecting you to write a post containing a MRE (Minimum Reproducible Example). A very good discussion explaining why using reprex helps, but is not enough, to build a reproducible example:

As in joelt92 case, the issue is nearly never just setwd itself: the point is that setwd is usually the premise to a sequence of instructions which no one else, apart from the OP, can perform. For example, if I were to run kndrtt code on my machine, these lines would fail, even if I had a folder STATISTIKA somewhere in my file system:

duom <- read.csv2("PGS2011.csv",header = T,sep = ",") 
macro <- read_excel("macro.xlsx", skip = 1)

because I don't have files PGS2011.csv and macro.xlsx on my machine. This is explained very well in the reprex dos and don'ts link that Mara already shared above -- the very first suggestion is to use the smallest, simplest, most built-in data possible. And the reason is exactly that, otherwise, we won't be able to run your code.

3 Likes