I have a list of 6 sublists, each sublist contains 3 dataframes.
I want to set the row names of the dataframes to a column in that datagram.
list_1 <- list(df1, df2, df3)
list_2 <- lapply(list_1, function(x) split(x, x$Type))
I try to rename the rows of the data frames with lapply
lapply(list_2, function(x) column_to_rownames(x, var=x$Rows))
print(df1)
Rows A
1 Baseline 4
2 Sample1 5
3 Sample2 8
4 Sample3 6
5 AASHTO 9
6 Mean 3
print(df2)
Rows A
1 Baseline 4
2 Sample1 7
3 Sample2 8
4 Sample3 6
5 AASHTO 4
6 Mean 3
print(df3)
Rows A
1 Baseline 3
2 Sample1 5
3 Sample2 6
4 Sample3 6
5 AASHTO 5
6 Mean 3