Git Product home page Git Product logo

Comments (3)

mtennekes avatar mtennekes commented on May 22, 2024

Hi Stephan,

Seems like dplyr and data.table bite each other:

df <- data.frame(x=1:2, y=3:4, z=c("foo", "bar"))
class(df)
[1] "data.frame"
df <- df %>% rowwise %>% mutate(y = x+y) # for this example only
class(df)
[1] "rowwise_df" "tbl_df" "tbl" "data.frame"
dfDT <- as.data.table(df)
class(dfDT)
[1] "rowwise_df" "tbl_df" "tbl" "data.table" "data.frame"

I will have a look at it, a good reason for me to learn dplyr:)

Best,
Martijn

On 15/02/12 4:46 PM, Stephan Renatus wrote:

Hi,

The following behaviour confused me a lot today (maybe just for future
reference)

library(dplyr)
library(treemap)
df <- data.frame(x=1:2,y=3:4,z=c("foo","bar"))
treemap(df,index="z",vSize="x",type="index")# all good!

df <- df %>%rowwise %>% mutate(y = x+y)# for this example only
df
Source: local data frame [2 x 3]
Groups:

x y z
1 1 4 foo
2 2 6 bar

class(df)
[1]"rowwise_df" "tbl_df" "tbl" "data.frame"
treemap(df,index="z",vSize="x",type="index")
Error in :=(vColor.temp,1):
Check that is.data.table(DT)== TRUE.Otherwise,:= and :=(...)are defined for use in j,once only and in particular ways.See help(":=").
ungroup(df) %>% treemap(index="z",vSize="x",type="index")# all good!

I don't suggest that treemap does the ungroup'ing, but I'd not have
expected it to be that harmful ;)

Thanks!


Reply to this email directly or view it on GitHub
#14.

from treemap.

mtennekes avatar mtennekes commented on May 22, 2024

dplyr works now!

from treemap.

srenatus avatar srenatus commented on May 22, 2024

Thanks @mtennekes :)

from treemap.

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.