I have a data frame that is consists of strings. Now I want to merge the first two rows of the data frame and set them as headers. I have a sample data frame below:
sample_data=data.frame(a=c("a ","sdf ","kjk ","oijd "),b=c("dkj ","oie ","lkd ","ohf"),c=c("sdk ","oij ","oie ","iuhi"),d=c("411 ","sdf ","iuf ","ijef"))
> sample_data
> sample_data
a b c d
1 a dkj sdk 411
2 sdf oie oij sdf
3 kjk lkd oie iuf
4 oijd ohf iuhi ijef
I want the output to resemble the below structure:
a sdf dkj oie sdk oij 411 sdf
1 kjk lkd oie iuf
2 oijd ohf iuhi ijef
Can anyone help me with this please?