You need to pass 'LineName' as a variable. Currently you're just writing "LineName" as a string-literal.
There are a few functions which can do this:
Paste0
Paste0 combines character vectors (literals or objects) into a single string:
load(paste0(“TfL/Line/", LineName, "/Arrivals.Rdata"))
Glue
Glue is a CRAN package which functions in a similar way to paste0
, but can be easier to write and read:
#install.packages("glue") #<- run if you don't have glue installed
require("glue") # attach the package so that we can use 'glue'
load(glue("TfL/Line/{LineName}/Arrivals.Rdata"))
If run either of those inside your function, it will work as intended.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…