as.numeric with comma decimal separators?

前端 未结 7 1651
野性不改
野性不改 2020-11-27 04:32

I have a large vector of strings of the form:

Input = c(\"1,223\", \"12,232\", \"23,0\")

etc. That\'s to say, decimals separated by commas,

相关标签:
7条回答
  • 2020-11-27 05:27
    as.numeric(sub(",", ".", Input, fixed = TRUE))
    

    should work.

    0 讨论(0)
提交回复
热议问题