'how to use colnames() inside of a forloop to show all colnames from a list
I am trying to loop through a list of data frames to quickly check a bunch of data all at once.
source_files <- list.files(pattern = "\\.csv$")
got a list of csv files in my working directory
for (i in source_files) {
assign(substr(i,1,nchar(i)-4), read.csv(i))
}
use a for loop to read all the csv files
for (i in source_files) {
n <- substr(i,1,nchar(i)-4)
glimpse(n)
}
however this doesn't work. I tried it with a few functions like glimpse, colnames...etc and none of them seem to work. glimpse returns chr "2021xxxdata"
i want to check them before i combine them with bind_rows. any better way to do this? or a way to make this work?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
