我有一列要更改的250行。
例如:1 x 10-10成1E-10或 3.51 x 10-16变成3.51E-16
每列中都有不同的P值。
答案 0 :(得分:1)
Using evil parse:
sapply(chartr("x-", "*^", x), function(i) eval(parse(text = i)), USE.NAMES = FALSE)
# [1] 1.00e+10 3.51e+16
Just noticed it is minus in power:
sapply(gsub("-", "^-", gsub("x", "*", x, fixed = TRUE), fixed = TRUE),
function(i) eval(parse(text = i)), USE.NAMES = FALSE)
# [1] 1.00e-10 3.51e-16
If the answer is parse() you should usually rethink the question.
- Thomas Lumley, R-help (February 2005)