You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
No rush on my end, I'm working on r-lib/vctrs#1961 and I noticed it when adding tests. I've got a little helper for tests that retains names, so no issues for me
I typically do take the stance that as.* should retain names because it (always?) retains length, and if you retain the length you can also map the names over.
I do wish R would make up its mind on whether as.* retains names 🙃
@MichaelChirico something we should bring up in the bug tracker? I understand that its not a pressing issue to the usual user but should be consistent at least.
hi @joshhwuu , @MichaelChirico
i think one way is to capture the names of the input and restore them setattr(res,''names'',nm), i plan to apply this to as.idate.date,as.idate.numeric,as.idate.POSIXctand theas.itime.numericto ensure teh consistency across bothidateand theitime```.
if this sounds good i will be happy to proceed with the pr .
Activity
DavisVaughan commentedon Aug 14, 2025
Another test case for you is this particularly confusing case - due to
c.IDatecallingas.IDate()Created on 2025-08-14 with reprex v2.1.1
MichaelChirico commentedon Aug 14, 2025
Thanks...
Confirmed on a more recent version too.
Most importantly, this is not consistent with
as.Date():I do wish R would make up its mind on whether
as.*retains names 🙃Do you have a use case in mind to help set priority for a fix?
DavisVaughan commentedon Aug 14, 2025
No rush on my end, I'm working on r-lib/vctrs#1961 and I noticed it when adding tests. I've got a little helper for tests that retains names, so no issues for me
DavisVaughan commentedon Aug 14, 2025
I typically do take the stance that
as.*should retain names because it (always?) retains length, and if you retain the length you can also map the names over.MichaelChirico commentedon Aug 14, 2025
I tend to agree but it's not quite so simple:
DavisVaughan commentedon Aug 14, 2025
I guess I have feelings about the shape of that return value too 😛
ben-schwen commentedon Aug 18, 2025
@MichaelChirico something we should bring up in the bug tracker? I understand that its not a pressing issue to the usual user but should be consistent at least.
venom1204 commentedon May 26, 2026
hi @joshhwuu , @MichaelChirico
i think one way is to capture the names of the input and restore them
setattr(res,''names'',nm), i plan to apply this toas.idate.date,as.idate.numeric,as.idate.POSIXctand theas.itime.numericto ensure teh consistency across bothidateand theitime```.if this sounds good i will be happy to proceed with the pr .