dan - 2 months ago 20

R Question

I have

`numeric`

`a <- -1.542045`

And I want to round them down to 2 digits after the decimal point. So for this example the result will be

`-1.55`

With

`signif(a,3)`

Any idea?

Answer

I think you are looking for `floor(a * 100) / 100`

.

**Quick Test**

```
a <- c(-1.542045, 1.542045)
floor(a * 100) / 100
# [1] -1.55 1.54
```