I have several hundred files, each of which represent prices for a particular stock, and I want to loop through them, calculate log return, and add the log return as a column in a data frame containing log returns for all of the stocks. 

Essentially, I have something like this, say I have three csvs that are named "a.csv", "b.csv" and "c.csv", and they look something like (the numbers below are totally fabricated, the idea is just that the dates are not necessarily the same, nor are the files the same length, but they have the same columns and names):

a.csv:

```
Date    Adj.Close
1/1/2001    5
1/2/2001    5.25
1/3/2001    5.17
1/4/2001    5.09
1/5/2001    5.83

```

b.csv:

```
Date    Adj.Close
3/17/2005   17.85
3/18/2005   19.20
3/19/2005   18.55
3/20/2005   18.45

```

c.csv:

```
Date    Adj.Close
5/9/1995    25.39
5/10/1995   25
5/11/1995   25.83
5/12/1995   24.99
5/13/1995   28
5/16/1995   27.17
5/17/1995   26.95

```

I know how to calculate log returns for one file (the below works fine for one file):

```
setwd('my_wd')
data <- read.csv('a.csv')
attach(data) 
n = dim(data)[1] 
log_rtn = diff(log(Adj.Close)) 

```

That gives me a list of the log returns for the first csv. What I want to do (in pseudo code) is:

```
for file in my_wd:
 data <- file_name.csv
 attach(data) 
 n = dim(data)[1] 
 file_name_log_rtn = diff(log(Adj.Close)) 

```

in order to return lists of log returns named in the same was as the csv (in pseudo-output), something like (named after the file, as below):

a\_log\_rtn:

```
0.048790164, -0.015355388,-0.015594858,0.13573917

```

b\_log\_rtn:

```
0.072906771, -0.03444049,-0.005405419

```

c\_log\_rtn:

```
-0.015479571,0.032660782,-0.033060862,0.113728765,-0.030091087,-0.008130126

```