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

debugme modifies data.frame to list inside R6 class field #42

Open
samssann opened this issue Feb 13, 2020 · 0 comments
Open

debugme modifies data.frame to list inside R6 class field #42

samssann opened this issue Feb 13, 2020 · 0 comments
Labels
bug an unexpected problem or unintended behavior

Comments

@samssann
Copy link

enabling debugme through R environment variable (and building the package again), modifies data.frames in R6 class fields from data.frames to lists.

zzz.R

.onLoad <- function(libname, pkgname) {
  debugme::debugme()
}

testClass.R

library(R6)
testClass <- R6Class(
  classname = "testClass",
  public = list(
    initialize = function() {
      print(class(private$df))
      print(private$df)
    },
    df2 = data.frame(
      ID = c(0,1,2,3),
      name = c("a","b","c","d"),
      bool = c(T,F,F,F),
      stringsAsFactors = F
    )
  ),
  private = list(
    df = data.frame(
      ID = c(0,1,2,3),
      name = c("a","b","c","d"),
      bool = c(T,F,F,F),
      stringsAsFactors = F
    )
  )
)

output

> library(testpackage)
> testClass
<testClass> object generator
  Public:
    df2: data.frame
    initialize: function () 
    clone: function (deep = FALSE) 
  Private:
    df: data.frame
  Parent env: <environment: namespace:testpackage>
  Locked objects: TRUE
  Locked class: FALSE
  Portable: TRUE
> Sys.getenv("DEBUGME")
[1] ""
> Sys.setenv("DEBUGME" = "testpackage")

Restarting R session...

> library(testpackage)
> Sys.getenv("DEBUGME")
[1] "testpackage"
> testClass
<testClass> object generator
  Public:
    df2: list
    initialize: function () 
    clone: function (deep = FALSE) 
  Private:
    df: list
  Parent env: <environment: namespace:testpackage>
  Locked objects: TRUE
  Locked class: FALSE
  Portable: TRUE

session info

─ Session info ────────────────────────────────────────────────────────────────────────────────────────
 setting  value                       
 version  R version 3.6.0 (2019-04-26)
 os       Ubuntu 18.04.4 LTS          
 system   x86_64, linux-gnu           
 ui       RStudio                     
 language (EN)                        
 collate  C.UTF-8                     
 ctype    C.UTF-8                     
 tz       Etc/UTC                     
 date     2020-02-13                  

─ Packages ────────────────────────────────────────────────────────────────────────────────────────────
 ! package     * version date       lib source        
   assertthat    0.2.1   2019-03-21 [1] CRAN (R 3.6.0)
   cli           2.0.1   2020-01-08 [1] CRAN (R 3.6.0)
   crayon        1.3.4   2017-09-16 [1] CRAN (R 3.6.0)
   debugme       1.1.0   2017-10-22 [1] CRAN (R 3.6.0)
   fansi         0.4.1   2020-01-08 [1] CRAN (R 3.6.0)
   glue          1.3.1   2019-03-12 [1] CRAN (R 3.6.0)
 P packrat       0.5.0   2018-11-14 [?] CRAN (R 3.6.0)
   R6            2.4.1   2019-11-12 [1] CRAN (R 3.6.0)
   sessioninfo   1.1.1   2018-11-05 [1] CRAN (R 3.6.0)
   testpackage * 0.1.0   2020-02-13 [1] local         
   withr         2.1.2   2018-03-15 [1] CRAN (R 3.6.0)
@samssann samssann changed the title debugme modifies data.frame to list inside R6 class private field debugme modifies data.frame to list inside R6 class field Feb 13, 2020
@gaborcsardi gaborcsardi added the bug an unexpected problem or unintended behavior label Nov 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants