Skip to content

acast different column and row sorting in R 3.2.4 and R 3.3.0 under Ubuntu and CentOS #79

@ghost

Description

Dear Prof Wickham,

I recently came across the fact that the sorting of columns and rows after using acast changes depending on the R version and platform used:

Ubuntu:

require(stringi)
require(plyr)
require(reshape2)
df <- data.frame(a=c("C10 Rep 1", "C106 Rep 1"),b=c("first-1","first1"),c=c(1,2))
dfc <- acast(data = df, formula = `b`~a, value.var = "c")
dfc
        C106 Rep 1 C10 Rep 1
first1           2        NA
first-1         NA         1
sessionInfo()
R version 3.2.4 Revised (2016-03-16 r70336)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu precise (12.04.5 LTS)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8   
 [6] LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] reshape2_1.4.1 plyr_1.8.4     stringi_1.1.1 

loaded via a namespace (and not attached):
[1] magrittr_1.5  tools_3.2.4   Rcpp_0.12.6   stringr_1.0.0

CentOS:

require(stringi)
require(plyr)
require(reshape2)
df <- data.frame(a=c("C10 Rep 1", "C106 Rep 1"),b=c("first-1","first1"),c=c(1,2))
dfc <- acast(data = df, formula = `b`~a, value.var = "c")
dfc
        C10 Rep 1 C106 Rep 1
first-1         1         NA
first1         NA          2
sessionInfo()
R version 3.3.0 (2016-05-03)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8   
 [6] LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] reshape2_1.4.1 plyr_1.8.4     stringi_1.1.1 

loaded via a namespace (and not attached):
[1] magrittr_1.5  tools_3.3.0   Rcpp_0.12.6   stringr_1.0.0

Is this the expected behaviour due to recent changes in R regarding available sorting methods? In any case, it would be nice if the sorting of columns and rows could be consistent between different versions of R.

Thank you very much for your tremendous contribution to the community.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions