0
我有一個數據框可以提取發佈在討論論壇上的消息線索。通過從數據庫連接表,我得到它看起來像這樣的結構:R提取打印R標記的數據幀值
threadStarterName1 threadstarter1 comment1 commenterName1
threadStarterName1 threadstarter1 comment2 commenterName2
threadStarterName1 threadstarter1 comment3 commenterName3
threadStarterName1 threadstarter1 comment4 commenterName4
threadStarterName1 threadstarter1 comment5 commenterName5
代碼來創建這個數據幀:如下,
df=data.frame("threadStarterName"=c("threadStarterName1","threadStarterName1","threadStarterName1","threadStarterName1","threadStarterName1"),
"threadStarter"=c("threadStarter1","threadStarter1","threadStarter1","threadStarter1","threadStarter1"),
"comment"=c("comment1","comment2","comment3","comment4","comment5"),
"commenterName"=c("commenterName1","commenterName2","commenterName3","commenterName4","commenterName5"))
我要重新格式化該數據幀中提取值,其然後我可以在R-markdown打印出報告:
threadstarter1 threadStarterName1
comment1 commenterName1
comment2 commenterName2
comment3 commenterName3
comment4 commenterName4
comment5 commenterName5
在此先感謝!
你可以發佈你的代碼到目前爲止? – GrandMasterFlush
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example請從一個可重複的例子開始。 –
在這篇文章中有些特定的東西不清楚(使用'dput()'或其他來自Brandon鏈接的建議可以修復):threadstarter和message1是同一列還是不同的列?是'row1 row2' ...'row.names'屬性還是另一列?你的專欄是什麼課?這是否需要推廣到多個消息,還是數據框只包含'message1'?還有,你有什麼嘗試?它在哪裏失敗?你是怎麼被卡住的? – Gregor