Data
row1=c("A","B","C")
row2=c("D","E",NA)
df=data.frame(rbind(row1,row2))
df
X1 X2 X3
row1 A B C
row2 D E NA
I want to 2row & 1col data frame, and the type of data is character
for example,
"1. A - 2. B - 3. C"
"1. D - 2. E"
Is there any other way other than using a loop?
I saw tidyr::unite, do.call, sprintf, ... But it's hard to apply in my case.
The dimensions of the actual data are larger. Actual data has more than 10 columns.