Getting error in file(file, rt): cannot open the connection
Most likely you are trying to open files from the working directory instead of the directory in which you called list.files
. Instead try
D1 <- do.call("rbind",
lapply(paste0("~/R/natural-language-processing/class-notes/",
file.list),
read.csv, header = TRUE, stringsAsFactors = FALSE))
Alternatively, you can set the full.names
argument to TRUE
in list.files
to get complete paths:
file.list <- list.files(path="~/R/natural-language-processing/class-notes",
pattern=".csv", full.names = TRUE)
Error in file(file, rt) : cannot open the connection in r even after setting right path
The error is because the path is wrong: you forgot the trailing slash in the path prefix in str_c
. However, rather than using str_c
, you can instruct list.files
to give you full paths from the get-go:
files <- list.files(
path = "C:/Users/91932/Downloads/archive (2)/Fitabase Data 4.12.16-5.12.16",
pattern = ".csv",
full.names = TRUE
)
Related Topics
Checking If Date Is Between Two Dates in R
Plotting Pca Biplot with Ggplot2
If Else Condition in Ggplot to Add an Extra Layer
Is There a Weighted.Median() Function
Cartesian Product with Dplyr R
Change Day of the Month in a Date to First Day (01)
Counting the Frequency of an Element in a Data Frame
Spreading a Two Column Data Frame with Tidyr
How to Delete the First Row of a Dataframe in R
Exactly Storing Large Integers
How to Test If List Element Exists
Controlling Order of Facet_Grid/Facet_Wrap in Ggplot2
How to Return Number of Decimal Places in R
Get Rid of \Addlinespace in Kable
Ggplot2, Axis Not Showing After Using Theme(Axis.Line=Element_Line())