File and variable

I can seem to figure this out.

I have a directory here. C:/reports/20191231/report1.csv

I want to have the "report1.csv" as a variable I can load.

So I want to be able to load "report2.csv" and next time I want to just change the variable and put "report3.csv" and so on.

I don't want to combine them all either.

I tried


File=
read_csv("C:\\reports\\20191231\\",({File}),""")```

If I understand your issue correctly, this should do it

filename = "report1.csv"
File = read_csv(file.path("C:/reports/20191231", filename))
1 Like

Yes that works! Thank you!

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.