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

Error in apply_guides on diffPrint(df, df, extra = list(row.names = FALSE)) #111

Closed
HenrikBengtsson opened this issue Nov 28, 2017 · 1 comment
Labels
Milestone

Comments

@HenrikBengtsson
Copy link

Trying to compare two data.frame:s using print(..., row.names = FALSE) gives an error in some cases (not always - I think it might be related to factors but not sure). Here is a minimal example. With:

> library("diffobj")
> df <- data.frame(x = "A")

this works:

> diffPrint(df, df)
No visible differences between objects.
< df         > df       
@@ 1,2 @@    @@ 1,2 @@  
    x            x      
  1 A          1 A      

> diffPrint(df, df, extra = list(row.names = TRUE))
No visible differences between objects.
< print(d..  > print(d..
@@ 1,2 @@    @@ 1,2 @@  
    x            x      
  1 A          1 A     

but trying to apply extra = list(row.names = FALSE) fails:

> diffPrint(df, df, extra = list(row.names = FALSE))
Error in apply_guides(target, tar.capt, guide_fun) : 
  `guides*` method must produce an integer vector containing unique index values for the `obj.as.chr` vector; If you did not specify a `guides` function or define custom `guides*` methods contact maintainer (see `?guides`).  Proceeding without guides.
In addition: Warning messages:
1: In min(which(!space.rows & seq_along(space.rows) > head.row)) :
  no non-missing arguments to min; returning Inf
2: In max(which(!space.rows)) :
  no non-missing arguments to max; returning -Inf

This is with:

> sessionInfo()
R version 3.4.2 (2017-09-28)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.3 LTS

Matrix products: default
BLAS: /usr/lib/atlas-base/atlas/libblas.so.3.0
LAPACK: /usr/lib/atlas-base/atlas/liblapack.so.3.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] 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] diffobj_0.1.7

loaded via a namespace (and not attached):
[1] compiler_3.4.2 tools_3.4.2    crayon_1.3.4 

PS. Thanks for a brilliant package!

@brodieG
Copy link
Owner

brodieG commented Nov 28, 2017

Thanks for the nice MRE. I can confirm the problem. Recent r-devel changes are causing test failures so I probably will fix this as I fix the failing tests. In the meantime you can use:

diffPrint(df, df, extra = list(row.names =F), guides=FALSE)

although it degrades the usability a little bit. One other option is to provide your own guides function that properly handles the formatting of rowname-less dfs (see ?diffobj::guides, but not for the faint of heart).

@brodieG brodieG added the bug label Nov 28, 2017
@brodieG brodieG added this to the 0.1.8 milestone Nov 28, 2017
brodieG added a commit that referenced this issue Dec 10, 2017
Fix #113: r-devel test breaks due to 'str' changes
Fix #111: handle rowname-less DFs and related bugs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants