Category "tidyr"

How can I find the nearest date after another date in a different column in grouping by ID using R?

I am looking for a method that will look at each date in "Date A" and find the next nearest date after that value in "Date B" by ID (group_by). I then want to c

Reshape wide data to panel format with multiple paired columns using tidyr

In a large survey, the data are encoded as (Respondent, question, year binary, question, year binary). As in: R Question1 | 2008 Bin. | Question2 | 2009

R Dataframe By Group Calculation

I have a dataframe like below (the real data has many more people and club): Year Player Club 2005 Phelan Chicago Fire 2007 Phelan Boston Pant 2

Scatterplot comparing two variables with ggplot and tidy data

With untidy data, running a scatterplot comparing two variables is trivial in either base R or ggplot2. For example, here is a sample scatterplot from R for Dat

separate_columns for tidyr

Let's say I had a survey question that read: What did you eat? [ ] apple [ ] pear [x] banana [x] grapes Now, I have the endorsed options as comma-separated st

Taking only the maximum values of duplicate IDs for all columns of a data frame in R

I have data frame of 24525 rows and 22 columns. Last column is the ID column, other are numeric. Number of unique IDs is 18414 and some IDs are repeated more th

tidyr use separate_rows over multiple columns

I have a data.frame where some cells contain strings of comma separate values: d <- data.frame(a=c(1:3), b=c("name1, name2, name3", "name4", "name5