R how to change dafaframe column name using listname
I have a list y as shown below. I want to change the first column name of each dataframe (rn) to the name of the dataframe (SA, TA). So it will look like y1.
> y
$SA
rn X1 X2 X3 X4 X5 X6
1: timepoint 0 3.75 4.25 4.5 4.75 5
2: plot 234 304 285 279 256 238
$TA
rn X7 X8 X9 X10 X11 X12
1: timepoint 0 5 4.25 3.75 4.75 4.5
2: plot 208 299 272 261 254 218
> y1
$SA
SA X1 X2 X3 X4 X5 X6
1: timepoint 0 3.75 4.25 4.5 4.75 5
2: plot 234 304 285 279 256 238
$TA
TA X7 X8 X9 X10 X11 X12
1: timepoint 0 5 4.25 3.75 4.75 4.5
2: plot 208 299 272 261 254 218
+3
source to share