I'm trying to read in a csv file from a folder containing all csv files and having difficulty. So far I have changed my path, set my working directory and have identified all files as CSV in the working directory. When I run this line I get:
Error in file(file, "rt") : cannot open the connection In addition: Warning message: In file(file, "rt") : cannot open file '^GSPC.csv': No such file or directory .
I was wondering if anyone could please help. Thank you.
dir.data = "C:/Users/rileylong/desktop/Stocks/
setwd(dir.data)
listcsv <- dir(pattern = "*.csv")
data <- read.csv("^GSPC.csv", stringsAsFactors = FALSE)[,c(1,5)]