Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201977

Insert a column with file name

$
0
0

Having this code it is possible to read multiple csv from a file path

setwd("C:/Users/Nathalie/mycsvs")
files <- list.files(path = "C:/Users/Nathalie/mycsvs",pattern = ".csv")
temp <- lapply(files, fread, sep=",")

How is it possible to add a column to the dataframe which will have the file name each row came from?


Viewing all articles
Browse latest Browse all 201977

Trending Articles