如何从write.table CSV输出中删除ID

时间:2014-06-13 15:45:45

标签: r

执行此声明时:

write.table(bigdata, 'news.csv', sep = ',')

输出如下:

"type","text"
"1","neutral","The week in 32 photos"
"2","neutral","Look at me! 22 selfies of the week"
"3","neutral","Inside rebel tunnels in Homs"
"4","neutral","Voices from Ukraine"
"5","neutral","Water dries up ahead of World Cup"
"6","positive","Who's your hero? Nominate them"

但是,我不想要ID列,数字看起来像1,2,3,4 ......我只是想要这个:

"type","text"
"neutral","The week in 32 photos"
"neutral","Look at me! 22 selfies of the week"
"neutral","Inside rebel tunnels in Homs"
"neutral","Voices from Ukraine"
"neutral","Water dries up ahead of World Cup"
"positive","Who's your hero? Nominate them"

这是我的数据框:

> head(bigdata)
      type                               text
1  neutral              The week in 32 photos
2  neutral Look at me! 22 selfies of the week
3  neutral       Inside rebel tunnels in Homs
4  neutral                Voices from Ukraine
5  neutral  Water dries up ahead of World Cup
6 positive     Who's your hero? Nominate them

如何从输出中删除ID?

1 个答案:

答案 0 :(得分:9)

row.names = FALSE函数中指定write.table()将删除该ID列。