apache / apache/arrow

[R] Initializing an Arrow array from an R difftime or hms::hms rounds down to the nearest time unit

Open
#40,109 7 comments 0 reactions 0 assignees View on GitHub
Component: R Type: bug
Dominant language
C++
Stars
17.1k
Forks
4.3k
Avg merge
3d 13h
Merged PRs (30d)
88

Description

### Describe the bug, including details regarding any error messages, version, and platform.

```R
> delta <- as.difftime(c(0.000, 0.001, 0.002, 1, 1.5), units = "secs")
> delta
Time differences in secs
[1] 0.000 0.001 0.002 1.000 1.500
> arrow::Array$create(delta)
Array

[
0,
0,
0,
1,
1
]
```
This should be [0, 0.001, 0.002, 1, 1.5], not [0, 0, 0, 1, 1]. Same issue with `arrow::Array$create(hms::hms(c(0.000, 0.001, 0.002, 1, 1.5)))`, which becomes `time32[s]`.

R version 4.3.2, R Arrow version 14.0.1.

### Component(s)

R

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.