Giter Club home page Giter Club logo

Comments (3)

philibe avatar philibe commented on August 16, 2024

test <- rowwise(test) and rbind(test, test) seem to me like create a sort of recursive data. oO ?!

dput(test)
structure(list(col1 = c(1, 2, 3, 4, 5, 85, 74, 5, 32, 6, 8, 1, 
2, 3, 4, 5, 85, 74, 5, 32, 6, 8), col = c("A", "B", "B", "B", 
"A", "C", "A", "C", "B", "A", "A", "A", "B", "B", "B", "A", "C", 
"A", "C", "B", "A", "A")), row.names = c(NA, -22L), groups = structure(list(
    .rows = structure(list(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 
        10L, 11L), ptype = integer(0), class = c("vctrs_list_of", 
    "vctrs_vctr", "list"))), row.names = c(NA, -11L), class = c("tbl_df", 
"tbl", "data.frame")), class = c("rowwise_df", "tbl_df", "tbl", 
"data.frame"))

Try that:

test1 <- data.frame("col1" = c(1,2,3,4,5,85,74,5,32,6,8), "col" = c("A","B","B","B","A","C","A","C","B","A","A"))
test2 <- rowwise(test1)
test0 <- rbind(test1, test2)

test0 has a normal structure:

dput(test0)
structure(list(col1 = c(1, 2, 3, 4, 5, 85, 74, 5, 32, 6, 8, 1, 
2, 3, 4, 5, 85, 74, 5, 32, 6, 8), col = c("A", "B", "B", "B", 
"A", "C", "A", "C", "B", "A", "A", "A", "B", "B", "B", "A", "C", 
"A", "C", "B", "A", "A")), row.names = c(NA, -22L), class = "data.frame")

And filter works:

dplyr::filter(test0, col == "A") 
   col1 col
1     1   A
2     5   A
3    74   A
4     6   A
5     8   A
6     1   A
7     5   A
8    74   A
9     6   A
10    8   A

PS: I'm a simple user (ie not from the tidyverse team).

from dplyr.

Gastonia02 avatar Gastonia02 commented on August 16, 2024

My issue is that sometimes I use rbind on objects that both are grouped row-wise. This seems to create a recursive thing that make RStudio crash

This structure seems to be normal for dataframes grouped row-wise :

test1 <- data.frame("col1" = c(1,2,3,4,5,85,74,5,32,6,8), "col" = c("A","B","B","B","A","C","A","C","B","A","A"))
test01 <- rowwise(test1)

dput(test01)
structure(list(col1 = c(1, 2, 3, 4, 5, 85, 74, 5, 32, 6, 8), 
    col = c("A", "B", "B", "B", "A", "C", "A", "C", "B", "A", 
    "A")), class = c("rowwise_df", "tbl_df", "tbl", "data.frame"
), row.names = c(NA, -11L), groups = structure(list(.rows = structure(list(
    1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L), ptype = integer(0), class = c("vctrs_list_of", 
"vctrs_vctr", "list"))), row.names = c(NA, -11L), class = c("tbl_df", 
"tbl", "data.frame")))

But without rbind it does not crash :

dplyr::filter(test01, col == "A") 
# A tibble: 5 × 2
# Rowwise: 
   col1 col  
  <dbl> <chr>
1     1 A    
2     5 A    
3    74 A    
4     6 A    
5     8 A   

from dplyr.

etiennebacher avatar etiennebacher commented on August 16, 2024

This might be a duplicate of #7024, the issue was transferred to r-lib/vctrs#1935

from dplyr.

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.