I am importing roughly 140 large datasets. I am trying to build a function that imports these datasets and renames them with a QQYYYY (quarter, year) identifier. The (simplified) code I have thus far is below:
orig.first <- 'hist.dta_'
file.type <- '.txt'
clean.data <- function(qqyyyy) {
data.file <- paste(orig.first,qqyyyy,file.type,sep="")
origfile_ <<- read.table(data.file, sep="|", header=FALSE,
colClasses=origclass, quote="")
}
Currently this imports the dataset "hist.dta_Q11999.txt" globally fine, however, it will import it with the name "origfile_". I would like to concatenate, say, Q11999 (to represent the first quarter of 1999) onto origfile_ so it becomes "origfile_Q11999". Could somebody let me know a clean way to achieve this?