All Questions

-1
votes
1answers
798 views

Importing multiple .csv files with variable column types into R

How can I properly build an lapply to read (from out of one directory) all the .csv files, load all the columns as strings and then bind them into one data frame. Per this, I have a way to get all th...
3
votes
1answers
190 views

Print tibble with column breaks as in v1.3.0

Using the latest version of tibble the output of wide tibbles is not properly displayed when setting width = Inf. Based on my tests with previous versions wide tibbles were printed nicely until vers...
5
votes
1answers
1244 views

Spread with duplicate identifiers (using tidyverse and %>%)

My data looks like this: I am trying to make it look like this: I would like to do this in tidyverse using %>%-chaining. df <- structure(list(id = c(2L, 2L, 4L, 5L, 5L, 5L, 5L), start_end =...
2
votes
1answers
143 views

Grouping on multiple programmatically specified vars in dplyr 0.6

This is with the new dplyr, to be released Real Soon Now. The dplyr programming vignette gives an example of calling group_by with the grouping variables specified in an outer function: my_summarise...
5
votes
3answers
536 views

R: create dummy variables based on a categorical variable *of lists*

I have a data frame with a categorical variable holding lists of strings, with variable length (it is important because otherwise this question would be a duplicate of this or this), e.g.: df <- d...
-1
votes
1answers
51 views

Split Strings into values in long dataframe format

I have a dataframe that looks like the following example df which consist of a character variable VAR. df<-data.frame(ID = 1:2, VAR = c("VAL1\r\nVAL2\r\nVAL8","VAL2\r\nVAL5"), ...
5
votes
1answers
110 views

Map for nested `data_frame`s

When using map on a nested data_frame, I do not understand why the latter two version give an error: library(tidyverse) # dummy data df <- tibble(id = rep(1:10, each = 10), val =...
0
votes
2answers
112 views

using tidyverse; counting after and before change in value, within groups, generating new variables for each unique shift

I am looking for a tidyverse-solution that can count occurrences of unique values of TF within groups, id. When TF changes I want to count both forward and backwards from that point. This counting sho...
4
votes
2answers
75 views

Faster method than "while" loop to find chain of infection in R

I'm analyzing large tables (300 000 - 500 000 rows) that store data output by a disease simulation model. In the model, animals on a landscape infect other animals. For example, in the example picture...
2
votes
2answers
65 views

Efficient way to Fill Time-Series per group

I was looking for a way to fill a time series data set by time, per group. The very very inefficient way I was using was to split the data set per group and apply a custom time-series fill function (c...

Previous Next