Error in source(filePath) : 2020-01-18_14_8.R:5:7: unexpected symbol

So I recently got a job and I am trying to run someone else's codes on a bunch of R files. I keep getting this error.
Here is what some of the code looks like:

files <- paste(list_files, sep = '/')
files <- files[which(str_detect(files,'\.R'))]

findItems <- function(filePath){
source(filePath)

Here is the error messgae:

Error in source(filePath) : 2020-01-18_14_8.R:5:7: unexpected symbol
4:
5: Often True
^

What is my mistake? Thanks

Try

files <- files[which(str_detect(files,".*\\.R$")]

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.