-
Notifications
You must be signed in to change notification settings - Fork 985
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
confusing POSIXlt warning #2068
Comments
See
Maybe I'm not understanding what you expect? |
Hey @MichaelChirico thanks for your response. I am aware that strptime returns POSIXlt, but I thought that it was strange that data.table warns about "column type" even when the strptime neither uses nor assigns to a column. for example |
Why not just
Though this is somewhat in contradiction to
Which doesn't throw the warning:
Though I think in the longer term the plan is to move all of these helper functions to C, perhaps by proxy by moving |
on a related note, in the old version of data.table (before the strptime helper function) I was using DT[, date := as.POSIXct(strptime(chr, format))] and now we can use DT[, date := strptime(chr, format)] but it always raises that warning so to avoid it I am always writing DT[, date := suppressWarnings(strptime(chr, format))] which is kind of annoying... I wonder if you would consider just removing the warning altogether? Another way to explain the issue is the following. I expect that the return value of strptime should stay POSIXlt when I am using it like this data.table(X=1)[, {
lots of code
doing lots of things
some.intermediate.variable.which.I.expect.is.POSIXlt <- strptime(chr, format)
return something else
}] but I expected that ANY POSIXlt (not just the ones that come from strptime) should be converted to POSIXct for assignment to a data.table column via DT[, date.POSIXct := someFunctionThatReturnsPOSIXlt()] |
When Definitely need to keep the warning. |
ok well don't worry about it then, it's not a big deal |
I get the same warning for this line of code (R 3.5.2, data.table 1.12.0): |
OK so what's happening is that the evaluation environment of Lines 1151 to 1154 in a8e926a
From there, it doesn't discriminate on whether Note that AFAIK |
Hey guys thanks for all your hard work making data.table great!
Can you please clarify the warning that is issued when
strptime
is used inside of the second argument of[.data.table
? Right now it says "POSIXlt column type detected and converted to POSIXct" even in cases whenstrptime
does not operate on columns at all.For example this is a MRE which is potentially confusing:
I'm not sure there should be a warning at all in this case.
The text was updated successfully, but these errors were encountered: