Skip to content

c on zero length POSIXct fails #1004

@bart1

Description

@bart1

I just got reported a bug in the move package. This is the result of a concatenation of an zero length POSIXct. This works perfectly well in base R and behaves like other vectors (e.g. c(numeric(0)). However when lubridate is loaded this now fails. As this error is new to me I assume it relates to recent changes in this package (probably: 1570baa ). I think this combining of zero length strings should not produce an error.

(a<-structure(numeric(0), class = c("POSIXct", "POSIXt"), tzone = "UTC"))
#> POSIXct of length 0
c(a)
#> POSIXct of length 0
require(lubridate)
#> Loading required package: lubridate
#> 
#> Attaching package: 'lubridate'
#> The following objects are masked from 'package:base':
#> 
#>     date, intersect, setdiff, union
a
#> POSIXct of length 0
c(a)
#> Error in class(xx) <- cl: attempt to set an attribute on NULL
sessionInfo()
#> R version 4.1.2 (2021-11-01)
#> Platform: x86_64-pc-linux-gnu (64-bit)
#> Running under: Ubuntu 20.04.3 LTS
#> 
#> Matrix products: default
#> BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
#> LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0
#> 
#> locale:
#>  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
#>  [3] LC_TIME=nl_NL.UTF-8        LC_COLLATE=en_US.UTF-8    
#>  [5] LC_MONETARY=nl_NL.UTF-8    LC_MESSAGES=en_US.UTF-8   
#>  [7] LC_PAPER=nl_NL.UTF-8       LC_NAME=C                 
#>  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
#> [11] LC_MEASUREMENT=nl_NL.UTF-8 LC_IDENTIFICATION=C       
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#> [1] lubridate_1.8.0
#> 
#> loaded via a namespace (and not attached):
#>  [1] knitr_1.34      magrittr_2.0.1  rlang_0.4.12    fastmap_1.1.0  
#>  [5] fansi_0.5.0     stringr_1.4.0   styler_1.6.1    highr_0.9      
#>  [9] tools_4.1.2     xfun_0.27       utf8_1.2.2      withr_2.4.2    
#> [13] htmltools_0.5.2 ellipsis_0.3.2  yaml_2.2.1      digest_0.6.28  
#> [17] tibble_3.1.5    lifecycle_1.0.1 crayon_1.4.1    purrr_0.3.4    
#> [21] vctrs_0.3.8     fs_1.5.0        glue_1.4.2      evaluate_0.14  
#> [25] rmarkdown_2.11  reprex_2.0.1    stringi_1.7.5   compiler_4.1.2 
#> [29] pillar_1.6.4    generics_0.1.1  backports_1.2.1 pkgconfig_2.0.3

Created on 2021-11-15 by the reprex package (v2.0.1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions