四舍五入列中的值 - SparkR

Rounding off values in a column - SparkR

我在数据框的一列中有以下值

231204.66666666666
             376.0
          346593.5
             802.0
          346594.5
             801.0
          346595.5
             800.0
              null
               0.0

我只想要此列中的绝对值。我如何在 SparkR 中做到这一点?

我从 SparkR 找到了 abs 和 round 可以完成这项工作。但不幸的是它没有出口。当我使用 Spark::abs(df$col)```

时出现以下异常

Error: 'abs' is not an exported object from 'namespace:SparkR'

我也遇到了 SparkR::round 的相同错误。

我尝试了下面的方法,但列值没有改变。

df$col <- abs(df$col)

如何获取列中的绝对值?

你给的样本在abs()下没有变化。 abs 必须与 round 结合使用。像, round(abs(df$col))