[R] Loop over rda list files and using the attach function

Juan Ceccarelli Arias jfca283 at gmail.com
Tue Aug 30 17:43:29 CEST 2016

I need to loop over rda files.
I generated the list of them.
That's ok. The problem is that the name of the files are as yyyy_mm (eg
2010_01 is january or 2010, 2016_03 is march of 2016).
So, when i try to use the attach function to create a simple table(age,
sex) it fails.
The only way to attach a file as is using
The text above i have no idea how to declare it in my code below

dd=list.files("C:/Users/Me/r", pattern="rda$", full.names=F)
for (i in 1:length(dd)) {
table(age, sex)

This is the error it declares the loop:
Error in attach(yyz) : file '2013_02' not found

Thanks for your help and time

	[[alternative HTML version deleted]]

More information about the R-help mailing list