Git Product home page Git Product logo

Comments (19)

dcomtois avatar dcomtois commented on September 5, 2024 1

Oh... Then I'll have a look at this as soon as I can... Glad you found a working solution... Pls let me know if you observe unwanted side-effects!

from summarytools.

Payamdel avatar Payamdel commented on September 5, 2024 1

No side-effects observed! :)

from summarytools.

Payamdel avatar Payamdel commented on September 5, 2024 1

Congratulations! You solved the issue nicely!
I think the function works as a charm now :)
Hope there will be a new release/update of the package soon!
Cheers

from summarytools.

dcomtois avatar dcomtois commented on September 5, 2024

See this stackoverflow post for more...

from summarytools.

Payamdel avatar Payamdel commented on September 5, 2024

I have now looked further into it and found that the problem occurs due to this line: rownames(output)[i] <- paste0("Var",i).
If you replace this line with rownames(output)[i] <- paste0(colnames(x.df)[i]) the problem is solved!

What do you think?

from summarytools.

dcomtois avatar dcomtois commented on September 5, 2024

Actually no, this line is the "last resort" that applies only when previous attemps at recuperating rownames have failed.... So trying there again will not help... The names extraction is done in parse_args.R, and if the object is not visible in the Global environment, varnames are lost. So the challenge is to go look for it in the specific environment it is in.

from summarytools.

Payamdel avatar Payamdel commented on September 5, 2024

Ok!
But when I use: rownames(output)[i] <- paste0(colnames(x.df)[i]) in descr(), the names are desplayed, in my example data!

from summarytools.

dcomtois avatar dcomtois commented on September 5, 2024

It makes me realize I need to re-think the way attributes (in particular variable names) are retrieved. Things get complicated with with(), by(), and lapply() in general, but for the colnames part, I see that I can simplify things (and make them work with shiny, too). A big thanks for your input on this @Payamdel !

from summarytools.

Payamdel avatar Payamdel commented on September 5, 2024

You are welcome!
Hope there will be a new release/update for "summarytools" available soon, including this fix!

from summarytools.

Payamdel avatar Payamdel commented on September 5, 2024

@dcomtois Could it be that the variable names are lost in Shiny due to the following codes in options.R ?

.st_env <- new.env(parent = emptyenv())
.st_env$tmpfiles <- c()

#Initialize list used by view() when printing an object of class "by"
.st_env$byInfo <- list()

from summarytools.

dcomtois avatar dcomtois commented on September 5, 2024

Hi... I'm still abroad on vacation but I'll look into it as soon as I can. Thx

from summarytools.

dcomtois avatar dcomtois commented on September 5, 2024

Ok I'm finally back... descr should work fine now in Shiny Apps... Could you pls test it on your side? The fix is in the dev-current branch, so you'll need to install it:

devtools::install_github("dcomtois/summarytools", ref = "dev-current")

As for your question regarding .st_env, this seems to work fine with Shiny. It's the environment where the information on iterative processes (when using by or lapply) are stored in order for view to output things neatly. Let me know if you observe problems in that area. Thx!

from summarytools.

Payamdel avatar Payamdel commented on September 5, 2024

So nice to here from you!
I have tried to install the package using the code you provided here (i.e. devtools::install_github("dcomtois/summarytools", ref = "dev-current")). But unfortunately, I get

"Installation failed: Command failed (255)"

Any idea?

from summarytools.

dcomtois avatar dcomtois commented on September 5, 2024

Hello!

Hmmm not sure why this happens. Can you install any other package with devtools::install_github? I saw that some people had problems with the unzipping, c.g.:

r-lib/devtools#1722
r-lib/devtools#638

from summarytools.

Payamdel avatar Payamdel commented on September 5, 2024

The problem with installation is solved by setting options(unzip = "internal") before installing from github, as suggested by (r-lib/devtools#1722). So thanks for that!
Gonna test descr function and let you know how it works on my Shiny app!

from summarytools.

Payamdel avatar Payamdel commented on September 5, 2024

I need to report a related issues when it comes to the name of Group variable. More specifically, I found that the Name of Group variable does not change sometime even if I changed the group variable in the app. It should be noted that the table updates upon selection a new group variable. So the problem is related to the fact that the name of group variable dose not updates accordingly!

Would like to have look at this issue too?

from summarytools.

dcomtois avatar dcomtois commented on September 5, 2024

from summarytools.

AndreGuerra123 avatar AndreGuerra123 commented on September 5, 2024

Still happens. I have the latest installation and when I use a functions like:

getHtmlDescriptive <-function(iris){
  st<-summarytools::descr(iris)
  return(htmltools::renderTags(summarytools::view(st,method='render',omit.headings = TRUE))$html)
}

It perfoms ok, but if I do something like:

getHtmlDescriptive <-function(df){
  st<-summarytools::descr(df)
  return(htmltools::renderTags(summarytools::view(st,method='render',omit.headings = TRUE))$html)
} 

it fails to retrieve var names.
testing with:
getHtmlDescriptive(iris)

from summarytools.

dcomtois avatar dcomtois commented on September 5, 2024

Could you try again after reinstalling from devtools::install_github("dcomtois/summarytools") pls? I pushed the changes from the dev-current branch, I think it should work now.

from summarytools.

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.