[R-pkg-devel] Warning 'as.data.frame.POSIXct()' is deprecated
Vincent van Hees
v|ncentv@nhee@ @end|ng |rom gm@||@com
Thu Jul 6 09:54:20 CEST 2023
Dear all,
I see the following warning in my package test results:
```
Warning
Direct call of 'as.data.frame.POSIXct()' is deprecated. Use
'as.data.frame.vector()' or 'as.data.frame()' instead
```
The warning is not always there and I struggle to make it reproducible. I
have encountered it in both Ubuntu 22.04 and in Windows 11, in both R 4.3.0
and 4.3.1, in both RStudio and in an GitHub Actions environment (example
<https://github.com/wadpac/GGIR/actions/runs/5463862340/jobs/9945096566>).
The warning gives the impression that I am doing something that R no longer
supports. However, I am not using the command as.data.frame.POSIXct()
anywhere directly in my code.
When I dive into the code where the warnings occur I see patterns like:
```
now = Sys.time()
df = data.frame (time = seq(now, now + 10, by =1), B = 1:11)
```
(this is a simplification of for example:
https://github.com/wadpac/GGIR/blob/master/tests/testthat/test_read.myacc.csv.R
)
Does this mean I am discouraged from putting a vector with POSIXct values
in a data.frame?
If yes, what would be the recommended work around?
I have been trying to find documentation or online discussions about this
warning but no luck so far. I see R NEWS
<https://cran.r-project.org/doc/manuals/r-release/NEWS.html> mentions
updates to POSIXct related objects several times in the past year but those
seem to be different issues.
Best,
Vincent
[[alternative HTML version deleted]]
More information about the R-package-devel
mailing list