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