I am new in using R and I got this code sniplet from my supervisor: 

```
for (i in 1:k) mean.mat[i, ] <- mean(data.frame[i])

```

However, as I found out, mean for data frames does not longer work. So I tried to come up with the following solution: 

```
for (i in 1:k) mean.mat[i, ] <- lapply(norm.df[i], mean, na.rm = TRUE)

```

But I am getting the following error message:

```
Error in mean.mat[i, ] <- lapply(norm.df[i], mean, na.rm = TRUE) : incorrect number of subscripts on matrix

```

Does anybody know why this doesn't work and how I can replace the `mean()` function?