给定这样的数据框:
DL<-c("Dark52","Light-298","dark7","23_dark","The_light","Lights","77dark","9Light")
Col1<-c(1,12,3,6,4,8,2,8)
DF<-data.frame(Col1)
row.names(DF)<-DL
如何创建包含行名称的“暗”或“亮”元素的第二列?
所以最终结果看起来像这样
Col2<-c("Dark","Light","dark","dark","light","Light","dark","Light")
DF$Col2<-Col2
Col1 Col2
Dark52 1 Dark
Light-298 12 Light
dark7 3 dark
23_dark 6 dark
The_light 4 light
Lights 8 Light
77dark 2 dark
9Light 8 Light