R - Order each matrix inside a list of matrices
Because I did not have your exact data (I don't have the csv file), I created a dummy dataframe (swiped from this tutorial):

numPeople = 10
sex=sample(c("male","female"),numPeople,replace=T)
age = sample(14:102, numPeople, replace=T)
income = sample(20:150, numPeople, replace=T)
minor = age&lt;18

population = data.frame(sex=sex, age=age, income=income, minor=minor)
population

&gt; population
      sex age income minor
1    male  34    130 FALSE
2    male  48     86 FALSE
3  female 101     36 FALSE
4    male  64     78 FALSE
5  female  97     92 FALSE
6    male  19     45 FALSE
7  female  42    124 FALSE
8  female  24     68 FALSE
9  female  24     96 FALSE
10 female  91     30 FALSE


This means you will have to adjust the variable names and so on to match your example, but can learn how to order a list of matrices. More specifically, you really have a list of data.frame objects, after using the split function. it is important to notice the difference between a data.frame and a matrix, as they can behave differently.

I will split the data.frame by the sex column:

l = split(population, population$sex)


You can test that each element of the resulting list is indeed a data.frame (and not a matrix) by running:

&gt; is.data.frame(l[[1]])
[1] TRUE


Notice that you have to use the doublesquare brackets to access the actual element of the list. Single square brackets will return something else:

&gt; is.data.frame(l[1])
[1] FALSE


Tt is a named list-element and needs to be referenced by using (in my case) one of the names of the group that we split on: male or female
Below I comment the code heavily to explain what each step does.

&gt; l[1]
$female                          # this is the name of the list element
     sex age income minor
1 female  20     42 FALSE
6 female  75    103 FALSE
7 female  30    148 FALSE


So we can access the actual element two ways:


by name:

&gt; l[1]$female
     sex age income minor
1 female  20     42 FALSE
6 female  75    103 FALSE
7 female  30    148 FALSE

by double square brackets:

&gt; l[[1]]
 sex age income minor
1 female  20     42 FALSE
6 female  75    103 FALSE
7 female  30    148 FALSE



That all being said, he is a working example of sorting a list (vector, holding lists) containing data.frames:

l = split(population, population$sex)    # population is defined as shown above
N = length(l)

results &lt;- vector("list", N)

for(i in 1:N) {

    results[[i]] &lt;- l[[i]][order(l[[i]]$age),]
}


I specify the length of the vector when I create it, as we know how long the resulting list will be in advance.
... and check the results:

&gt; results[[1]]
    sex age income minor
8 female  66     90 FALSE
5 female  69    131 FALSE
2 female  70     52 FALSE
9 female  95     43 FALSE

&gt; results[[2]]
    sex age income minor
6  male  18     87 FALSE
4  male  61     97 FALSE
3  male  64    131 FALSE
7  male  72     93 FALSE
1  male  82    107 FALSE
10 male  92     42 FALSE


The results depend on random choice when creating population at the beginning, using sample().