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 do I format tibbles?

I'd like to make a table that looks like this I have tibbles with each of the data points, but they're not combined. library('dplyr') library('ISLR') data(Hitters) Hitters <- na.omit(Hitters) Q <- Hitters %>% group_by(League) %>% …
Sebastian
  • 957
  • 3
  • 15
  • 27
0
votes
1 answer

Create 24 columns and a dummy if timespan overlaps with hour

I have a "start" and "end" timestamp. df <- structure(list(Vagt_Start = structure(c(1535412600, 1531006200, 1518823800, 1535671800, 1531092600, 1527550200, 1535499000, 1530919800, …
xhr489
  • 1,957
  • 13
  • 39
0
votes
1 answer

What are my options when dealing with very large tibbles?

I am doing some pre-processing on on data from multiple sources (multiple large CSV's, above 500mb), applying some transformations and ending up with a final tibble dataset whcih has all the data that I need in a tidy "format." At the end of that…
Jean_N
  • 489
  • 1
  • 4
  • 19
0
votes
1 answer

Multiply tibbles elementwise

I have two tibbles (equal number of rows and columns) like this: first <- tibble::tribble( ~date, ~col1, ~col2, "2000-01-01", 8.2, 10.10, "2000-01-02", 3.2, 20.30, "2000-01-03", 2.3, …
user8934968
0
votes
1 answer

I would like to use dplyr::mutate than plyr::ddply function in pipeline processing

I would like to do the same what I have done here by mutate function not by ddplyr one. Is it possible to perform not vectorized operation here somehow? test <- tibble::tibble( x = c(1,2,3), y = c(0.5,1,1.5) ) d <- c(1.23, 0.99, 2.18) test %>%…
koralgooll
  • 392
  • 1
  • 3
  • 12
0
votes
1 answer

Is there an helper function to make this code cleaner on tibble?

I need to sum sequences generated by one of column. I have done it in that way: test <- tibble::tibble( x = c(1,2,3) ) test %>% dplyr::mutate(., s = plyr::aaply(x, .margins = 1, .fun = function(x_i){sum(seq(x_i))})) Is there a cleaner way to do…
koralgooll
  • 392
  • 1
  • 3
  • 12
0
votes
1 answer

R: How to name columns in get_acs from tidycensus?

When I run age <- get_acs(geography="tract",table="B01001",state="IL") I get the following error: Getting data from the 2012-2016 5-year ACS Loading ACS5 variables for 2016 from table B01001. To cache this dataset for faster access to ACS tables in…
theresawalrus
  • 347
  • 2
  • 19
0
votes
1 answer

Row subsets of `Tibble` loses custom s3 class

If I extract a row from a dataframe, my custom s3 class stays: test_df = iris class(test_df) <- c("test_class", class(test_df)) class(test_df[1,]) [1] "test_class" "data.frame" But this does not work for tibbles: test_df <-…
astrofunkswag
  • 2,608
  • 12
  • 25
0
votes
1 answer

In R, trying to convert a ragged CSV into data.frame of Value, list

I have an input file like: 1A10, 77002, 77003, 77010, 77020 1A20, 77002, 77006, 77007, 77019 1A30, 77006, 77019, 77098 1A40, 77007, 77019, 77027, 77098 1A50, 77005, 77007, 77019, 77024, 77027, 77046, 77081, 77098, 77401 etc.... I want to create a…
0
votes
1 answer

Passing a column name containing spaces to filter_() inside a custom function

can anyone show me how to get such a function working: library(tidyverse) ## Testing Data: dat <- tibble(without_space=rep(c(0,1),5), `with space`=rep(c(1,0),5)) ## Some custom function containing filter: custom_filter <- function(data, column,…
Florian
  • 147
  • 3
  • 7
0
votes
1 answer

converting json to data frame in R

I realize there are several questions on Stack Overflow that ask something similar to this already, but I cannot seem to apply them to my specific problem. I'm trying to convert the following json formatted data to a data frame. This data is from…
user8229029
  • 883
  • 9
  • 21
0
votes
1 answer

How to create a tibble with repeated and unrepeated measures of several variables in r?

I would like to create a tibble with a mix of repeated and unrepeated measures of variables along with the dates when they were measured; 3 variables (var1, var2, var3) that were measured 16 times during the months of April, May, June at irregular…
Mleinss
  • 37
  • 5
0
votes
0 answers

Strange output from a a multiple condition case_when

I am using a case_when to run through a set of p.values and slopes to produce text describing the output. This thought approach has worked for me in the past, but now I am seeing some text output that is flat wrong. In the small example below you…
kray
  • 377
  • 1
  • 3
  • 11
0
votes
1 answer

How can I add rows into a single row?

I have a tibble: # A tibble: 10 x 2 term sumsq 1 a1 10.1 2 a2 5.15 3 a3 45.1 4 a4 7.32 5 a1:a2 0.870 6 a1:a3 …
maximusdooku
  • 5,242
  • 10
  • 54
  • 94
0
votes
1 answer

R - mutate columns with different formats

I'm trying to do analysis from multiple csv files, and in order to create a key that can be used for left_join I think that I need to try and merge two columns. At present I'm trying to use the tidyverse packages (inc. mutate), but I'm running into…
arnold-c
  • 337
  • 2
  • 13