为什么write.csv()将数字列转换为字符串?

时间:2017-08-04 14:21:46

标签: r csv dataframe converter

我的数据框包含五个字符列和一个数字列。当我导出数据框时,所有列都转换为包括数字列的字符串。我该如何避免这种情况?

我的数据框结构:

Classes ‘tbl_df’, ‘tbl’ and 'data.frame':   3194 obs. of  6 variables:
 $ State_FIPS_Code         : chr  "00" "01" "01" "01" ...
 $ County_FIPS_Code        : chr  "000" "000" "001" "003" ...
 $ Postal_Code             : chr  "US" "AL" "AL" "AL" ...
 $ Name                    : chr  "United States" "Alabama" "Autauga County" "Baldwin County" ...
 $ Poverty_Percent_All_Ages: num  14.7 18.5 12.7 12.9 32 22.2 14.7 39.6 25.8 20 ...
 $ geoid                   : chr  "00000" "01000" "01001" "01003" ...

导出代码:

write.csv(dfGeoid, file = "MyData.csv", row.names=T)

0 个答案:

没有答案