Giter Site home page Giter Site logo

Comments (10)

bthieurmel avatar bthieurmel commented on July 16, 2024

Fix now updating setDataProvider method.

from ramcharts.

happyshows avatar happyshows commented on July 16, 2024

@bthieurmel I still found this error when I use the latest dev version, could you take a another look?

`R version 3.2.1 (2015-06-18)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

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

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

other attached packages:
[1] digest_0.6.8 rAmCharts_1.1.3 httr_1.1.0 jsonlite_0.9.16
[5] taucharts_0.4.4.9000 ADAP.Util_0.5.0 tidyr_0.4.1 dplyr_0.4.3.9001
[9] shinyBS_0.61 shinydashboard_0.5.1 shinyAce_0.2.1 DT_0.1.45
[13] rpivotTable_0.1.5.9 shiny_0.13.1.9000

loaded via a namespace (and not attached):
[1] Rcpp_0.12.3 pipeR_0.6.0.6 RColorBrewer_1.1-2 RJDBC_0.2-4
[5] tools_3.2.1 RSQLite_1.0.0 lattice_0.20-31 DBI_0.3.1
[9] rstudioapi_0.5 yaml_2.1.13 curl_0.9.2 rJava_0.9-6
[13] knitr_1.12.3 htmlwidgets_0.5.2 devtools_1.6.1 grid_3.2.1
[17] data.table_1.9.6 R6_2.0.1 magrittr_1.5 htmltools_0.3
[21] rlist_0.4.5.1 assertthat_0.1 mime_0.3 xtable_1.7-4
[25] httpuv_1.3.3 lazyeval_0.1.10 chron_2.3-45 zoo_1.7-11 `

from ramcharts.

bthieurmel avatar bthieurmel commented on July 16, 2024

Clean & restart your session to be sure that the package is updated.

Normally, all of this working :

require(rAmCharts)
require(dplyr)
require(data.table)

data(data_gdp)

amPieChart(valueField = 'gdp', titleField = 'country', 
           dataProvider = data_gdp)

amPieChart(valueField = 'gdp', titleField = 'country', 
           dataProvider = data.table(data_gdp))

amPieChart(valueField = 'gdp', titleField = 'country', 
           dataProvider = tbl_df(data_gdp))

amPieChart(valueField = 'gdp', titleField = 'country') %>%
  setDataProvider(data_gdp)

amPieChart(valueField = 'gdp', titleField = 'country') %>%
  setDataProvider(data.table(data_gdp))

amPieChart(valueField = 'gdp', titleField = 'country') %>%
      setDataProvider(tbl_df(data_gdp))

from ramcharts.

happyshows avatar happyshows commented on July 16, 2024

@bthieurmel

In R/tools_amTests.R you have the following code, which is causing such problem I guess
stop(paste0("class(", arg, ") is not in c('data.frame', 'data.table', 'tbl')"))

should be tbl_df not just tbl

In addition, I learned that instead of using not %in%, inherits(data, 'data.frame') is a cleaner solution.

from ramcharts.

bthieurmel avatar bthieurmel commented on July 16, 2024

This code is just the error message, not the control. Every thing seems to work for me with current version, using amFunctions or not, and data.frame, data.table, tbl_df or tbl_dt.

If not, using the latest version, please send us a concrete example on which you have an error.

from ramcharts.

happyshows avatar happyshows commented on July 16, 2024

I reinstalled the dev version, please find the below minimal example that fail:

library(dplyr)
library(tidyr)
library(rAmCharts)

src <- frame_data(
  ~Quarter,~Stage,~Qty,
  '01','A',0,
  '02','A',0,
  '03','A',3,
  '01','B',13,
  '02','B',200,
  '03','B',41
) %>% spread(Stage,Qty,fill = 0)

amBarplot(x='Quarter',y= c('A','B'),data = src, stack_type = 'regular') 

Error msg:
Error in .testFormatData(data) : class(data) is not in c('data.frame', 'data.table', 'tbl')

Note once data frame ran through spread() function, it lost the 'tbl' in its class

from ramcharts.

bthieurmel avatar bthieurmel commented on July 16, 2024

Thanks. This example work for me with dplyr_0.4.3 and tidyr_0.4.1. This packages cause numerous bugs with classes and functions S4. In my case, src have class "tbl_df" "tbl" "data.frame" after spread() function

from ramcharts.

happyshows avatar happyshows commented on July 16, 2024

Mine is on tidyr_0.4.1.9000 dplyr_0.4.3.9001

That's why using inherit(dat,'data.frame') seems to be safer.

from ramcharts.

bthieurmel avatar bthieurmel commented on July 16, 2024

I think (I hope...!) the problem is now resolved for both version of dplyr.

from ramcharts.

happyshows avatar happyshows commented on July 16, 2024

Thanks, new release works on the code I provided.

from ramcharts.

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.