rename variable dir to r