I have a large R script where I set the name of a regional variable, the name pf a timeseries variable and the nemae of the response variable at the top and then use the values within the code so that they are only ever changed at the top of the code. Toward the end of the code I want to order a df by my timeseries variable but it doesn't seem to work when used with a $ (liek the line below). Is there something I can use to get this to work or another way to write the order command? Thanks.
region <- "postcode"
timeseries <- "week"
response <- "sales"
.......loads of R logic
df2 <- df[order(df$timeseries),]