-
Notifications
You must be signed in to change notification settings - Fork 967
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
obscure error in melt #1754
Comments
EDIT: problem ended up being due to mistakenly assigning the same name to multiple columns. Tacking on another example of this:
Different runs will produce a slightly different error; sometimes instead of 'integer' it says 'character' or 'raw'. A few times the last line (printing
|
It is not just that columns have the same name, because that can also work just fine. This works fine:
This one will either error, or crash R:
SessionInfo:
|
@wpmarble your example actually segfaults on current dev:
|
I am having the same issue, segfault after calling melt on a data.table with two identical column names. Here is a MRE: library(data.table)
devtools::session_info()
buggy.dt <- fread("month,Record high,Average high,Daily mean,Average low,Record low,Average precipitation,Average rainfall,Average snowfall,Average precipitation,Average rainy,Average snowy,Mean monthly sunshine hours
Jan,12.8,-5.4,-8.9,-12.4,-33.5,73.6,28.4,45.9,15.8,4.3,13.6,99.2
Feb,15,-3.7,-7.2,-10.6,-33.3,70.9,22.7,46.6,12.8,4,11.1,119.5
Mar,25.9,2.4,-1.2,-4.8,-28.9,80.2,42.2,36.8,13.6,7.4,8.3,158.8
Apr,30.1,11,7,2.9,-17.8,76.9,65.2,11.8,12.5,10.9,3,181.7
May,34.2,19,14.5,10,-5,86.5,86.5,0.4,12.9,12.8,0.14,229.8
Jun,34.5,23.7,19.3,14.9,1.1,87.5,87.5,0,13.8,13.8,0,250.1
Jul,36.1,26.6,22.3,17.9,7.8,106.2,106.2,0,12.3,12.3,0,271.6
Aug,35.6,24.8,20.8,16.7,6.1,100.6,100.6,0,13.4,13.4,0,230.7
Sep,33.5,19.4,15.7,11.9,0,100.8,100.8,0,12.7,12.7,0,174.1")
tall.dt <- melt(buggy.dt, id.vars="month", verbose=TRUE)
print(tall.dt) The output I get on my system is:
I also tried with the current data.table github master (3db6e98) and I observed the same segfault. |
Hello, any updates with regard to 'melting' DT with >=2 identical columns? |
@sung for now, just rename. use |
Thanks, @MichaelChirico, it seems to work for now too: |
I have some more super-wide data and wanted to melt it:
if I had instead run with
melt(DT, names(DT)[1:2])
, I'd see the same message. Interestingly, when I repeat the command, I get a different error:After that, I never see the 'character' error again. I ran this a few times on my single-row example and managed to crash R. This error isn't a big problem, though; just means I need to approach the problem differently.
The text was updated successfully, but these errors were encountered: