Skip to content
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

arrange() on a data frame causes R to crash #338

Closed
wch opened this issue Mar 20, 2014 · 5 comments
Closed

arrange() on a data frame causes R to crash #338

wch opened this issue Mar 20, 2014 · 5 comments
Assignees
Milestone

Comments

@wch
Copy link
Member

wch commented Mar 20, 2014

If arrange is called with no ... arguments, it causes R to crash.

library(dplyr)
arrange(mtcars)
#  *** caught segfault ***
# address 0xfffffffffffffff8, cause 'memory not mapped'
@romainfrancois romainfrancois self-assigned this Mar 20, 2014
@romainfrancois romainfrancois added this to the v0.2 milestone Mar 20, 2014
@romainfrancois
Copy link
Member

I get a different problem :

> arrange(mtcars)
Erreur : not a promise

@romainfrancois
Copy link
Member

@hadley I've made it so arrange returns its input when there is no additional parameters, so no arranging at all. Is this alright ?

@hadley
Copy link
Member

hadley commented Mar 20, 2014

That's right. The only function that shouldn't do that is maybe summarise()

@romainfrancois
Copy link
Member

For a grouped data frame, summarise returns the labels attribute, which sounds good enough. For a non grouped, we get an empty data frame.

> .Internal(inspect(summarise(mtcars))
+ )
@1081290a0 19 VECSXP g0c0 [OBJ,ATT] (len=0, tl=0)
ATTRIB:
  @108128e00 02 LISTSXP g0c0 []
    TAG: @100823548 01 SYMSXP g1c0 [MARK,NAM(2),LCK,gp=0x4000] "class" (has value)
    @108124d68 16 STRSXP g0c1 [] (len=1, tl=0)
      @1008a7e60 09 CHARSXP g1c2 [MARK,gp=0x61,ATT] [ASCII] [cached] "data.frame"
    TAG: @100823078 01 SYMSXP g1c0 [MARK,NAM(2),LCK,gp=0x4000] "names" (has value)
    @108127390 16 STRSXP g0c0 [] (len=0, tl=0)
    TAG: @10082d060 01 SYMSXP g1c0 [MARK,LCK,gp=0x4000] "row.names" (has value)
    @108124e28 13 INTSXP g0c1 [] (len=2, tl=0) -2147483648,-1

But this data frames pretends to have one row and zero columns,
Maybe it could be simpler and just be equivalent to what data.frame() gives, so row.names would be an empty character vector instead.

@hadley
Copy link
Member

hadley commented Mar 20, 2014

Yeah, that sounds like a good idea.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants