I have a few hundred .csv's (here is a sample of 3 of these files) I would like to:
- Import into R
- Trim to a common row length
- Extract a specific column
- Combine into one data frame with object name as column name.
In my case I can get the files in fine using:
temp = list.files(pattern="*.csv")
list2env(
lapply(setNames(temp, make.names(gsub("*.csv$", "", temp))),
read.csv), envir = .GlobalEnv)}
but after trying a few different suggestions I can't see how to loop and trim the data frames to 25,000 observations each, and extract the 'data.Activity' column for each.
Ideally I would end up with an object 25,000 observations, and each of the 'data.Activity' variables from the supplied datasets named as their 'Clinstag_XX' ID.
Any help would be much appreciated.