将数据框的每一行/列合并成一个字符串
2019-12-30 本文已影响0人
董八七
用
apply()
。
# 1行2列,用空格分开
apply(df, 1, paste, collapse=" ")
from In R: Joining vector elements by row, converting vector rows to strings - Stack Overflow
用
apply()
。
# 1行2列,用空格分开
apply(df, 1, paste, collapse=" ")
from In R: Joining vector elements by row, converting vector rows to strings - Stack Overflow