Code Monkey home page Code Monkey logo

Comments (11)

spgarbet avatar spgarbet commented on August 27, 2024

This is an elusive bug I've been chasing for a good while. I don't think it's the number of variable but the variable name itself containing an underscore. Can you send the formula string you are using?

from tangram.

spgarbet avatar spgarbet commented on August 27, 2024

Also, what version are you using? The current CRAN release or from github?

from tangram.

kylerove avatar kylerove commented on August 27, 2024

My formula:
table3 <- tangram(group ~ eras_score[0] + eras_teaching_check[0] + preop_carb_check[0] + preop_diet_check[0] + preop_bowel_prep_check[0] + antibiotic_check[0] + dvt_ppx_check[0] + normothermia_check[0] + regional_anesthesia_check[0] + intraop_opioid_check[0] + intraop_fluids_check[0] + intraop_min_invasive_check[0] + intraop_ng_check[0] + intraop_drains_check[0] + postop_diet_check[0] + postop_ivf_check[0] + postop_mobilization_check[0] + postop_excessdrainremoval_check[0] + postop_adjunctive_check[0] + postop_antiemetic_check[0] + preop_carb_vol_norm[1] + preadmit_check[0] + preop_acetaminophen_check[0] + regional_block_check[0] + intraop_opioids[2] + intraop_ketamine_check[0] + intraop_dextamatomadine_check[0] + intraop_lidocaine_check[0] + intraop_anxiolytic_check[0] + intraop_steroids_check[0] + intraop_nsaids_check[0] + intraop_acetaminophen_check[0] + intraop_antiemetic_check[0] + ivf_crystalloid_rate[1] + ivf_colloid_rate[1] + ivf_blood_rate[1] + intraop_ogng_temp_check[0], data=allSingle, transform=my_percent) %>% del_col(2)

I'm using the latest from Github.

from tangram.

spgarbet avatar spgarbet commented on August 27, 2024

Okay, looking at it now.

from tangram.

spgarbet avatar spgarbet commented on August 27, 2024

As a workaround rbind() works with tangram objects.

from tangram.

spgarbet avatar spgarbet commented on August 27, 2024

I can't reproduce it. I suspect you have a hidden white space character hidden in the formula based on the error output you provided having a break in it. I expanded the definition of white space to include newlines and returns and pushed that up.

Install the latest and let me know what happens. If what I think is true then it will probably fail on not being able to access a variable due to the hidden character.

> library(tangram)
> x <- "group ~ eras_score[0] + eras_teaching_check[0] + preop_carb_check[0] + preop_diet_check[0] + preop_bowel_prep_check[0] + antibiotic_check[0] + dvt_ppx_check[0] + normothermia_check[0] + regional_anesthesia_check[0] + intraop_opioid_check[0] + intraop_fluids_check[0] + intraop_min_invasive_check[0] + intraop_ng_check[0] + intraop_drains_check[0] + postop_diet_check[0] + postop_ivf_check[0] + postop_mobilization_check[0] + postop_excessdrainremoval_check[0] + postop_adjunctive_check[0] + postop_antiemetic_check[0] + preop_carb_vol_norm[1] + preadmit_check[0] + preop_acetaminophen_check[0] + regional_block_check[0] + intraop_opioids[2] + intraop_ketamine_check[0] + intraop_dextamatomadine_check[0] + intraop_lidocaine_check[0] + intraop_anxiolytic_check[0] + intraop_steroids_check[0] + intraop_nsaids_check[0] + intraop_acetaminophen_check[0] + intraop_antiemetic_check[0] + ivf_crystalloid_rate[1] + ivf_colloid_rate[1] + ivf_blood_rate[1] + intraop_ogng_temp_check[0]"
> Parser$new()$run(x)
<ASTTableFormula>
  Inherits from: <ASTBranch>
  Public:
    clone: function (deep = FALSE) 
    distribute: function () 
    format: character
    initialize: function (left, right) 
    left: ASTVariable, ASTNode, R6
    reduce: function (df) 
    right: ASTPlus, ASTBranch, ASTNode, R6
    set_format: function (x) 
    string: function () 
    terms: function () 
    value: NA

from tangram.

kylerove avatar kylerove commented on August 27, 2024

I've looked at the input in my text editor and there are no invisible characters. I even typed out the last variable added to the formula here:

table3 <- tangram(group ~ eras_score[0] + eras_teaching_check[0] + preop_carb_check[0] + preop_diet_check[0] + preop_bowel_prep_check[0] + antibiotic_check[0] + dvt_ppx_check[0] + normothermia_check[0] + regional_anesthesia_check[0] + intraop_opioid_check[0] + intraop_fluids_check[0] + intraop_min_invasive_check[0] + intraop_ng_check[0] + intraop_drains_check[0] + postop_diet_check[0] + postop_ivf_check[0] + postop_mobilization_check[0] + postop_excessdrainremoval_check[0] + postop_adjunctive_check[0] + postop_antiemetic_check[0] + anastomosis, data=allSingle, transform=my_percent) %>% del_col(2) and it errors out on anastomosis, which has no special characters at all. It works fine without anastomosis, but errors when it is added.

from tangram.

spgarbet avatar spgarbet commented on August 27, 2024

I found it! when calling as.character on a formula in R it's adding returns when it goes beyond a certain fixed size, i.e. it's not dependent on the width option. I added the \n and \r as ignored white space in the last patch I pushed and it seems to be working for me. I tested the patch and it solves the issue.

from tangram.

spgarbet avatar spgarbet commented on August 27, 2024

b265131

from tangram.

kylerove avatar kylerove commented on August 27, 2024

Sweet. Yeah, the bug was really weird because it didn't matter which variable but always seemed to error out around the 21st-24th variable. Figures it was related to something with a fixed size. Nice job!

from tangram.

kylerove avatar kylerove commented on August 27, 2024

I confirm. Latest github code works now on my code example!

from tangram.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.