R - 如何删除包含数据但没有标题

时间:2017-12-19 21:02:39

标签: r

我有一个包含多个列的csv。第一列包含不需要的数据,但它也没有标题。我试图删除它,但它证明非常困难。它看起来像这样。

    name    manner_of_death armed   age gender  race    signs_of_mental_illness threat_level    flee    Per capita income   Median household income Median family income    Population  Number of households    Number of families
1   Joshua Smith    shot    knife   33  M   White   FALSE   other   Not fleeing $33,062 $71,583 $82,307 736,732 249,659 165,015
2   Vincent Nageak  shot    gun 36  M   Not Hispanic or Latino  FALSE   attack  Not fleeing $33,062 $71,583 $82,307 736,732 249,659 165,015
3   Patricia Kruger shot    gun 38  F   Not Hispanic or Latino  FALSE   attack  Not fleeing $33,062 $71,583 $82,307 736,732 249,659 165,015
4   Vincent J. Perdue   shot    gun 33  M   Not Hispanic or Latino  FALSE   attack  Car $33,062 $71,583 $82,307 736,732 249,659 165,015
5   John Martin Whittaker   shot    gun 33  M   White   FALSE   attack  Car $33,062 $71,583 $82,307 736,732 249,659 165,015
6   Micah McComas   shot    unarmed 41  M   White   FALSE   other   Car $33,062 $71,583 $82,307 736,732 249,659 165,015

我试过排除它,但这不起作用。

df1 <- df[,2:16]

我从外部网站上抓取的这些数据。

1 个答案:

答案 0 :(得分:-1)

试试这个:

df1 <- df[2:nrow(df),]