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

problem running examples 1 and 2 from d3treeR #1

Closed
FrissAnalytics opened this issue Jul 19, 2015 · 4 comments
Closed

problem running examples 1 and 2 from d3treeR #1

FrissAnalytics opened this issue Jul 19, 2015 · 4 comments

Comments

@FrissAnalytics
Copy link

Hi,

when I run the code for the first two examples on
http://www.buildingwidgets.com/blog/2015/7/17/week-28-d3treer

I get the following error:
Error in convert_treemap(data$tm, ifelse(!is.null(rootname), rootname, :
could not find function "as.Node"

I guess I either need a newer version of something or I'm missing a package? The treemap itself renders, but only as a static version. The d3.js flare example works thought, also in a Shiny app.

See below for my sessionInfo.

Hope you can help! Thanks in advance!

kind regards Herman

ps: great work on the htmlwidgets blog!

sessionInfo:
R version 3.1.3 (2015-03-09)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

locale:
[1] LC_COLLATE=Dutch_Netherlands.1252 LC_CTYPE=Dutch_Netherlands.1252
[3] LC_MONETARY=Dutch_Netherlands.1252 LC_NUMERIC=C
[5] LC_TIME=Dutch_Netherlands.1252

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

other attached packages:
[1] treemap_2.3 d3treeR_0.1 htmlwidgets_0.5 sortableR_0.1 shiny_0.12.1

loaded via a namespace (and not attached):
[1] bitops_1.0-6 chron_2.3-47 colorspace_1.2-6 curl_0.9.1 data.table_1.9.4
[6] data.tree_0.1.6 devtools_1.8.0 digest_0.6.8 ggplot2_1.0.1 git2r_0.10.1
[11] grid_3.1.3 gridBase_0.4-7 gtable_0.1.2 htmltools_0.2.6 httpuv_1.3.2
[16] httr_0.6.1 igraph_1.0.1 jsonlite_0.9.16 magrittr_1.5 MASS_7.3-40
[21] memoise_0.2.1 mime_0.3 munsell_0.4.2 plyr_1.8.3 proto_0.3-10
[26] R6_2.1.0 RColorBrewer_1.1-2 Rcpp_0.11.6 RCurl_1.95-4.5 reshape2_1.4.1
[31] rstudioapi_0.3.1 rversions_1.0.0 scales_0.2.5 stringi_0.5-5 stringr_1.0.0
[36] tools_3.1.3 XML_3.98-1.1 xtable_1.7-4 yaml_2.1.13

@timelyportfolio
Copy link
Collaborator

So glad you are trying this. I think the problem is that I am using the development branch of data.tree. If possible, could you try?

devtools::install_github("gluc/data.tree")

If that fixes the problem, I will add this to the examples.

Thanks again. I would love any additional feedback, ideas, use cases, criticism. It is a work in progress.

@FrissAnalytics
Copy link
Author

I installed the dev version as you suggested, unfortunately it still doesn't work. It did change something though. Before the code just wouldn't render. Now, the code renders, however, immediately after rendering the widget disappears. I also tested it in a shiny app, in that case nothing renders.

With respect to some additional feedback, first off great to see the commitment! I read it every week! It would be helpful to add a link to you github repos as cloning those is often fast and convenient. (I understand you are working on some more general repo for widgets?)

By the way, I also field tested your sortableR widget, which I also think has great potential. Two questions:

  1. If you dynamically create the content of the lists via renderUI the widget doesn't work properly (I think). For instance, let's modify your code and put a uiOutput call VariableSelector into it:

For ui.r we have:

    fluidRow(
      column(width = 4,
        tags$div(class="panel panel-default",
          tags$div(class="panel-heading","Variables"),
          tags$div(class="panel-body",id = "sort1", 

          uiOutput("VariableSelector")

          )
        )       
      ),
      column(width = 4,
        tags$div(class="panel panel-default",
          tags$div(class="panel-heading",tags$span(class = "glyphicon glyphicon-stats"),"Analyze as x (drag here)"),
          tags$div(class="panel-body",id = "sort2")
        )
      ),
      column(width = 4,
        tags$div(class="panel panel-default",
          tags$div(class="panel-heading",tags$span(class = "glyphicon glyphicon-stats"),"Analyze as y (drag here)"),
          tags$div(class="panel-body",id = "sort3")
        )            
      )
    ),
    sortableR( "sort1", options = list( group = "sortGroup1")),
    sortableR( "sort2", options = list( group = "sortGroup1")),
    sortableR( "sort3", options = list( group = "sortGroup1"))

then for server.r we have

  output$VariableSelector <- renderUI({
    lapply(colnames(mtcars),function(co){
      tag("p",list(class = class(mtcars[,co]),tags$span(class = "glyphicon glyphicon-move"),tags$strong(co)))
    }) 
  })

This code works, however, the items can no longer be added individually. It's either the whole list or nothing.

  1. I also was a bit confused how to get access to the indivual list items in server.r for sort1,sort2 and sort3.

@timelyportfolio
Copy link
Collaborator

Looks like your issue is same as mtennekes/treemap#17. I believe it should now be fixed. Please let me know.

@timelyportfolio
Copy link
Collaborator

@FrissAnalytics the commmit auto closed the issue. Feel free to reopen if still a problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants