Questions tagged [nested-tibble]
15 questions
                    
                    3
                    
            votes
                
                2 answers
            
        Make "tidy" tibble dataset with matrix variable
I have a dataset in a one-row-per-person format, but I want to merge in a dataset as a matrix variable -- basically, if not for the need of the tidy format, I would use a fuzzy join to merge in data from a range of dates, creating n x 3 rows.…
         
    
    
        ktmbiome
        
- 183
- 1
- 11
                    2
                    
            votes
                
                2 answers
            
        R transpose 2 matrices into a list of tibbles (for a nested df)
I have two matrices, of latitude and longitude, both of which are 50 column x 1 million (e.g.) rows. I need to create a list of 1 million tibbles, each 2 columns - lon and lat - and 50 rows. My current code is:
lonlat <- list()
for (i in…
         
    
    
        dez93_2000
        
- 1,730
- 2
- 23
- 34
                    1
                    
            vote
                
                1 answer
            
        rbind nested tibbles within groups
I have a tibble with a list column of tibbles (with compatible columns). I would like to rbind the tibbles after grouping. Here is a simplified example, where I would like to group on the tpm column:
library(tidyverse)
df_ex <- structure(list(
   …
         
    
    
        merv
        
- 67,214
- 13
- 180
- 245
                    1
                    
            vote
                
                1 answer
            
        Group tibbles by variables given as string vectors in a nested tibble
In a nested tibble, I would like to group tibbles in a list-column (data in the example below) by variables given as string vectors (vars).
toydata <- tibble::tibble(
  vars = list(
    list("x"), 
    list(c("x", "y"))
    ),
  data = list(
   …
         
    
    
        Koopa
        
- 77
- 3
                    1
                    
            vote
                
                1 answer
            
        how to load Rdata file contents into a tibble
I have a number of RData files in which a specific information is stored.
for (filename in c("file1", "file2", "file3")) {
  
  a = tibble(letters = sample(LETTERS, 10),
              numbers = sample(1:100, 10))
  
  save(a, file = paste0("tmp/",…
         
    
    
        mzuba
        
- 1,226
- 1
- 16
- 33
                    1
                    
            vote
                
                1 answer
            
        Group/summarize on nested tibble to append column lists
I have a tibble with a list-column of lists. In the case below, the list is the unique models for each of the carb-gear combinations.
my_df <- mtcars %>%
  rownames_to_column('model') %>%
  as_tibble() %>%
  select(model, gear, carb) %>%
 …
         
    
    
        Jeff Parker
        
- 1,809
- 1
- 18
- 28
                    1
                    
            vote
                
                2 answers
            
        How can I use a function to analyse all the rows in all the tibbles, having my data in a list of tibbles?
I have a list of 106 tibbles, each one contains two columns (date, temperature) with thousands of values.
I tried to create a function that allows me to get the index of the row, in which the temperature is lower than 8.0 four times by tibble.
The…
         
    
    
        M_1
        
- 119
- 1
- 10
                    1
                    
            vote
                
                1 answer
            
        googledrive4: How to filter a dribble (drive-tibble), applying criteria to nested list in a tibble?
Using googledrive4 package, accessing files on google drive is wonderfully easy.
p_load(googledrive4, tidyverse)
dribble1 <- drive_ls()
> dribble1
# A dribble: 2000 × 3
  name           id                                drive_resource   
     … 
         
    
    
        taiyodayo
        
- 331
- 4
- 13
                    1
                    
            vote
                
                1 answer
            
        Nested/grouped tibbles: using purrr:map inside mutate when a function has several arguments
I would like to apply a function to each group of a nested/grouped dataset using mutate. This example should help explain the goal. Need advise on how to code this correctly.
Make a fake dataset that is grouped/nested.
data(kidney)
grp_kidney <-…
         
    
    
        Brant Inman
        
- 53
- 3
                    0
                    
            votes
                
                1 answer
            
        creating columns in nested tibble if column does not exist
I am trying to extract data from a nested tibble. Within the outer tibble, not all tibbles may exist or be complete. In case of an non-existing column I would like to return 0.
df <- tibble(a = tibble(iris),
             b = tibble(iris[1:2]),
     …
         
    
    
        Joost Keuskamp
        
- 125
- 1
- 9
                    0
                    
            votes
                
                0 answers
            
        creating a nested tibble
I would like to create a tibble that contains a nested tibble, but also a column outside the nested tibble that refers to a column header within the nested tibble.  This is what I mean
library(tidyverse)
tib <- tibble(dat = list(tibble(xvar = 1,…
         
    
    
        Andrew
        
- 111
- 4
                    0
                    
            votes
                
                1 answer
            
        Entire character vector saved as a single string in R
I have some vectors I accidentally formatted the entire thing as character and now I can't revert it back into it being a vector. Is there a way to do this without going into regex?
Example
print(df[10])
[1] "c(\"1963-09-16\",…
         
    
    
        kraftwerk
        
- 35
- 3
                    0
                    
            votes
                
                1 answer
            
        Can not get the list of all dates from a list of tibbles
I have a list of tibbles or list columns, each tibble contain a column with dates and the other one temperatures.
I want to get the date in the index located in a vector but what I tried it doesn't work for a  reason that I can't see.
This is my…
         
    
    
        M_1
        
- 119
- 1
- 10
                    0
                    
            votes
                
                0 answers
            
        create a initial_split for multiple datasets nested on a tibble in R
I´m trying to fit several models and wanted to use a tibble to organize all the data, however I´m stuck at trying to split each dataset
here is   the example:
    library(tidyverse)
    library(tidymodels)
    my_data <-crossing(labels = c("A",…
         
    
    
        edperalt
        
- 23
- 5
                    0
                    
            votes
                
                1 answer
            
        How to match elements with a nested vector colum?
I am trying to see how the elements in nested vector match with the Order ID from Order_ID column and I'm not quite sure how to match them together. For example:
I would like to create code to match the Order ID with the separate element in the…
         
    
    
        newt335
        
- 175
- 1
- 1
- 9