我如何更正#NAME?数据框中的条目?

时间:2013-06-25 10:44:04

标签: r excel dataframe

我正在Kaggle.com上解决问题。我有这些数据,其中一些列有像“#NAME?”这样的条目如下。我知道有一些东西。我该如何更正这些内容?

zzucnDH33KlmbkI4rLyQTA  3.5 1   phoenix   AZ    5   maddu   -112.006669 33.598922
ZztUsJyGDwPySepmXRG13g  3   0   tempe     AZ    52  maddu   -111.93526  33.4251549
zzucnDH33KlmbkI4rLyQTA  3.5 1   phoenix   AZ    15  ski pro -112.03603  33.509844
#NAME?                  2.5 1   glendale  AZ    11  maddu  -112.2252989 33.64243764
#NAME?                  4   1   phoenix   AZ    549 maddu  -112.079081       33.49112

1 个答案:

答案 0 :(得分:1)

comment.char参数设置为“”:

read.table(text='zzucnDH33KlmbkI4rLyQTA  3.5 1   phoenix   AZ    5   maddu   -112.006669 33.598922
ZztUsJyGDwPySepmXRG13g  3   0   tempe     AZ    52  maddu   -111.93526  33.4251549
zzucnDH33KlmbkI4rLyQTA  3.5 1   phoenix   AZ    15  ski pro -112.03603  33.509844
#NAME?                  2.5 1   glendale  AZ    11  maddu  -112.2252989 33.64243764
#NAME?                  4   1   phoenix   AZ    549 maddu  -112.079081       33.49112',comment.char='',sep='\t')


                     V1  V2 V3       V4 V5  V6      V7        V8       V9
1 zzucnDH33KlmbkI4rLyQTA 3.5  1  phoenix AZ   5   maddu -112.0067 33.59892
2 ZztUsJyGDwPySepmXRG13g 3.0  0    tempe AZ  52   maddu -111.9353 33.42515
3 zzucnDH33KlmbkI4rLyQTA 3.5  1  phoenix AZ  15 ski pro -112.0360 33.50984
4                 #NAME? 2.5  1 glendale AZ  11   maddu -112.2253 33.64244
5                 #NAME? 4.0  1  phoenix AZ 549   maddu -112.0791 33.49112