2
我想在工作表中寫入我的data.frame時添加總行(如在Excel表中)。 這裏是(使用openxlsx
)我的本的代碼:R - 在Excel輸出中添加總行
writeDataTable(wb=WB, sheet="Data", x=X, withFilter=F, bandedRows=F, firstColumn=T)
X包含8個字符變量和1個數字可變一個data.frame。因此總行應該只包含數字行的總數(如果以某種方式我可以添加Excel總行數功能,那麼最好的方法是最好的,就像我在將表寫入工作簿對象時使用firstColumn一樣,而不是手動添加總行) 。
我在StackOverflow和官方的openxslx文檔中搜索了一個解決方案,但無濟於事。請使用openxlsx
建議解決方案。
編輯:
添加數據樣本:
A B C D E F G H I
a b s r t i s 5 j
f d t y d r s 9 s
w s y s u c k 8 f
總計行後:
A B C D E F G H I
a b s r t i s 5 j
f d t y d r s 9 s
w s y s u c k 8 f
na na na na na na na 22 na
請提出改進的問題沒有徹底downvoting首先使用
lapply
,並把它添加到
df
。 – Arani