R中character和factor的as.integer的不同

记录一个容易犯错的地方。

用chr标记的0~1变量可以变为整数0和1,

而用因子factor标记的变量转换为整数时总是从1开始。

如果不注意区分就会发生令自己困惑的错误。

原文地址:https://www.cnblogs.com/dingdangsunny/p/12468659.html