Git Product home page Git Product logo

Comments (15)

smartinsightsfromdata avatar smartinsightsfromdata commented on August 18, 2024

@timelyportfolio This is not correct. I am using rpivotable in a large shiny project I'm working on and I use it exclusively with data.table. I'll check on table.

from rpivottable.

timelyportfolio avatar timelyportfolio commented on August 18, 2024

Well, it did not work on my end. I'll just make it explicit, so it will not be a problem.

from rpivottable.

smartinsightsfromdata avatar smartinsightsfromdata commented on August 18, 2024

@timelyportfolio Please try again: I just tested it now.

from rpivottable.

timelyportfolio avatar timelyportfolio commented on August 18, 2024

I believe it depends on the toJSON that gets called and the data in the data.table. Not sure why being explicit will cause a problem.

from rpivottable.

smartinsightsfromdata avatar smartinsightsfromdata commented on August 18, 2024

@timelyportfolio there is no toJSON in the actual code. I used in the example to quickly transform some of the json I got hacking a web example that Nicolas was using on Canadian election.

from rpivottable.

timelyportfolio avatar timelyportfolio commented on August 18, 2024

htmlwidgets converts all parameters to JSON here . Since you don't believe me, try this:

rpivotTable(data.table(iris))

from rpivottable.

smartinsightsfromdata avatar smartinsightsfromdata commented on August 18, 2024

@timelyportfolio xtabs and table is different. But I am not sure it is a good idea to make the code too complex to manage these types. It is much better (and robust) to ask the user to convert.
Another story could be the new type tbl used by Hadley in dplyr, that he wants to design in compatibility with lap tools. I will ask him what are his plans and report back.

from rpivottable.

timelyportfolio avatar timelyportfolio commented on August 18, 2024

tbl_df will work fine with my change. Can add a warning about conversion so user is not surprised.

from rpivottable.

smartinsightsfromdata avatar smartinsightsfromdata commented on August 18, 2024

@timelyportfolio since you do not believe me try this in dat01.R (in the example folder):

rpivotTable(data = as.data.table(jsdf_))

I will look into why iris does not work, but it certainly not because it is a data.table.

from rpivottable.

timelyportfolio avatar timelyportfolio commented on August 18, 2024

I never said your data did not work. What I said is that I have a case where an error occurs and that I think we should handle. See these type checks/conversions from RStudio.

https://github.com/rstudio/dygraphs/blob/master/R/dygraph.R#L31-L33
https://github.com/rstudio/DT/blob/master/R/datatables.R#L43-L53

from rpivottable.

smartinsightsfromdata avatar smartinsightsfromdata commented on August 18, 2024

@timelyportfolio the error with iris occurs because iris column names have a dot and I suspect pivotable does not like that. If you convert the dot in the colname into a _ (underscore) it works. Try it.

from rpivottable.

timelyportfolio avatar timelyportfolio commented on August 18, 2024

I think this is another expectation that gets solved with a simple conversion using data.table built in conversion. toJSON was not built with data.table in mind so result will be more accurate with data.frame.

I'll submit a pull and you can decide.

from rpivottable.

smartinsightsfromdata avatar smartinsightsfromdata commented on August 18, 2024

@timelyportfolio it seems that the problem is with the dot but this emerges only after a conversion from data.frame to data.table. (a data.frame with no dots in the colnames is OK and of course a native data.table is OK).
As I am a strong data.table supporter / user, I'll report it to the data.table project: if there is something that breaks the data.frame / data.table parallelism Matt D. and co. needs to have a look at it.

from rpivottable.

smartinsightsfromdata avatar smartinsightsfromdata commented on August 18, 2024

@timelyportfolio I think the issue is between RJSONIO and data.table. See here

from rpivottable.

timelyportfolio avatar timelyportfolio commented on August 18, 2024

Oh, I know it is. In no way should this discussion suggest that I do not support data.table. I simply want rpivotTable to be robust. Once data.table is converted to JSON it doesn't matter what form it is in. In fact, toJSON will force convert unknown classes anyways. The step I added just assures that users get a good result.

from rpivottable.

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.