Questions tagged [tibble]

tibble could refer to an R class (tbl_df class), which is an improved data frame with stricter checking and better formatting. tibble could also refer to an R package providing functions to create and manipulate a tibble.

1309 questions
0
votes
1 answer

How to convert row names into column from list based data frame

I have the following list-based data-frame: df <- structure(c(5L, 300L, 251L, 42L, 187L, 16L, 2L, 249L, 158L, 17L, 77L, 3L, 2L, 166L, 92L, 16L, 86L, 6L, 5L, 104L, 82L, 17L, 37L, 3L, 1L, 248L, 239L, 10L, 81L, 2L, 0L, 136L, 107L, 6L, 24L, 3L,…
neversaint
  • 60,904
  • 137
  • 310
  • 477
-1
votes
1 answer

universal transpose tibble function

After much frustration, I have written my own function to transpose Tibbles I've attempted to make it universal so I don't have to rewrite it in the future Its purpose is a simple transpose like is possible in Excel special paste or t() for data…
-1
votes
2 answers

Apeend all sublist to other dataframe in R

Table Example So i have perform kind of methods for append printed substring to new list. But, the problem was it only return last of substring. My method was : for (ix in 1:length(komentar_aja)){ myList <- list() myList <- append(myList,…
-1
votes
1 answer

merge tibbles in R

I want to ask how can I merge Tibbles. I am trying to do a table for sociodemographics. Sample data frame: education <- c("high school", "elementary school", NA, "university", "high school") relationship <- c("single", "married", "divorced", NA,…
dplyr
  • 83
  • 5
-1
votes
1 answer

Transform a list of dataframes to a nested dataframe

I'm struggling with this problem: I have three lists of dataframes (each list has the same number of rows, each dataframe has 3 columns). I want to combine the lists into one nested dataframe, such that there are 3 columns (one column for a…
D3nz13
  • 74
  • 5
-1
votes
1 answer

How I can get the tibbles generated by lapply as a seperate dataframe in R

I have generated a loop using lapply. When I run the loop I get the tibbles like like this these two examples, but to save the space, I didn't address 10 tibbles here Color Variables value Yellow A 12 Red B 11 Blue B 4 …
user330
  • 1,256
  • 1
  • 7
  • 12
-1
votes
2 answers

How to speed up combining columns when one column is just a repetition of the same value?

Given the following data frame: df <- data.frame(one_letter = rep("a", 5), other_letters = letters[2:6]) df #> one_letter other_letters #> 1 a b #> 2 a c #> 3 a d #> 4 …
Emman
  • 3,695
  • 2
  • 20
  • 44
-1
votes
1 answer

In R, why am I getting "Error in [: (subscript) logical subscript too long"?

The below MWE Code 1 works fine, in calculating the sumproduct of 2 columns of numbers, with the sumproduct input matrix expanding horizontally to accommodate additional sumproduct scenarios. MWE Code 2 below is a modification of MWE Code 1 to make…
-1
votes
2 answers

Converting No Space date formatted as character to date

I have a date column where each date is written without spaces and is in character format. Date "20130402" "20130403" "20130404" I want to convert these values to date, but it does not work. I tried the following code to do so: dataframe %>% …
-1
votes
3 answers

Numbers as column name in tibbles: problem when using select()

I am trying to select some column by name, and the names are numbers. This is the code: df2 <- df1 %>% select(`Year`, all_of(append(list1, list2))) %>% I get this error: Error: Can't subset columns that don't exist. x Locations 61927, 169014,…
randomwalker
  • 183
  • 3
  • 11
-1
votes
1 answer

Compare Life Expectancy from an initial year 1952, and compare that expectancy to all further years, for all countries in R using Dplyr

In my R class, we are currently learning how to manipulate Tibbles. I have a homework problem where I need to grab the life expectancy from 1952 for a country and compare it to all its other expectancies for however many years of data the tibble…
-1
votes
1 answer

Tibble to dataframe

I have a large dataset and I want to filter out every row that has a certain value for year. I'm using R for the first time I searched a lot for it online and this is what it got me. My dataset is called matches. library(tidyverse) matches %>% …
-1
votes
1 answer

Can I pull data from multiple CSV files using primary key?

Apologies in advance for the noob question. I have 2 different csv data sets containing different information but share the same primary key "staff name". I'm trying to find out how productive employees are during the hours they worked by pulling…
illianyc
  • 1
  • 1
-1
votes
1 answer

How to get a straight up tibble

I want just Tibbles, but very often I end up with something terrible else. it looks like this: p <- tibble (idiotic= c(1,2,3,4,5)) %>% mutate(ma=rollapply(. [,1],2,mean,align='right',fill=NA)) and then I end up with a mess like this: It's a…
-1
votes
2 answers

How to paste strings between tibble's character column and rows in a nested list-column

I have a tibble with one character column and one list-column that nests dataframes. I want to collapse the dataframes in the list-column (using dplyr::bind_rows()) and append the respective value from the character column for each…
Emman
  • 3,695
  • 2
  • 20
  • 44