I have a list of dataframes and I want to assign the same column as the row names so when I print the dataframe, numbers do not appear. When I print out one of the dataframes in the list, I get the following result:
list1[["var1"]]
column1 NA
1 Variable Name value
2 Variable Collected at Waves value
3 Variable Short Description value
4 Method of Data Collection value
5 Variable Data Type value
6 Variable SAS Format value
7 Allowable Values value
8 Possible range of non-missing values value
9 Codes used for missing values value
I want the numbers on the left to be replaced by column 1 but applied to all lists entries. For example, it should look like this:
list1[["var1"]]
NA
Variable Name value
Variable Collected at Waves value
Variable Short Description value
Method of Data Collection value
Variable Data Type value
Variable SAS Format value
Allowable Values value
Possible range of non-missing values value
Codes used for missing values value
My best stab at it was here:
row.names(list1) <- lapply(list1, function(x) x['column1', ])