I am trying to automate a particular process in R, where essentially the code remains the same but the input files imported change- the path and most of the file name is the same only one word changes- and certain variable names change. I would like to make these changes user defined: much like %let in SAS. where i can call a value with &.
For example if i have this particular import code:
Category_sales<- read.csv("C:/Projects/Consumption curves/UKPOV/excel files/MSP_product_CC_2009_salespercap.csv")
Where I would like only the word MSP to change depending on what the user wants. In SAS I would define a macrovariable like say %let metric=MSP
and replace the code as
`C:/Projects/Consumption curves/UKPOV/excel files/&metric_product_CC_2009_salespercap.csv`
Also If I have a variable say MaxGNI and I would like only the GNI part to be user defined/replaced like Max&econvar where I could have econvar defined as %let econvar= GNI or any other metric.
I am looking for something similar in R however.