R: reading in a text file with the paste function -


i think should have simple answer haven't found yet. basically, want make function calls , reads in text file. here's have (i'm writing in ui.r file of shiny function, don't think that's part of problem):

popovers <- function(pop_name){   filename <- paste0("\'",pop_name,".txt\'")   js <- readchar(filename, file.info(filename)$size))   js } 

right now, can't concatenate filename since error "cannot coerce type 'closure' vector of type 'character'" paste0 function. ideas on how fix this? correct method of reading in various .txt files?

i got answer combining different suggestions comments. here's correct code:

popovers <- function(pop_name){   filename <- paste0(pop_name,".txt")   js <- readchar(filename, file.info(filename)$size))   js } 

i deleted quotes around ____.txt name , made sure pass popovers() string in quotes, such popovers("string"). long ___.txt file in working directory, should read in!


Comments