【发布时间】:2017-02-13 01:34:49
【问题描述】:
是否有可能在导入时声明属性列的数据类型,例如使用readOGR 命令的 ESRI Shapefile?
例如,我想在我的键列中保留前导零 (id_code):
example<- readOGR(example.shp", example")
str(example@data)
#'data.frame': 7149 obs. of 22 variables:
# $ id_code: num 101 102 103 104 105 106 107 108 109 110 ...
结果应该是这样的:
str(example@data)
#'data.frame': 7149 obs. of 22 variables:
# $ id_code: char "0101" "0102" "0103" "0104" "0105" "0106"...
我在read.csv() 函数中寻找类似于colClasses 的东西
【问题讨论】: