嗨,我已经看了很多其他的qns /答案,并且无法解决从列表表单到数字表单的强制。如果有用,列表最初是从一个因子中提取的(并且是1x33行)。
我的清单定义如下:
tmpseqsf[[1]]
它提供:
TradeValue
1 72914431
2 25325
3 20139
4 ...
所以基于其他建议(Stackoverflow等),我使用:
tmpx <-as.numeric(tmpseqsf[[1]])
但我得到错误:
Error: (list) object cannot be coerced to type 'double'
只是确认没有发生任何事情:
is.numeric(tmpseqsf[[1]])
[1] FALSE
有什么东西我完全不见了吗?
如果值是类型因子,那么您应该通过as.numeric(as.character(unlist(tmpseqsf[[1]])))
转换它们