Skip to main content

All Questions

Tagged with
3 votes
4 answers
69 views

Joining lat/lon data frames by nearest distance

Let's say I have a regular latitude/longitude grid and data at irregular locations, like this: grid = tidyr::crossing(lon = seq(0, 1, 0.25), lat = seq(0, 1, 0.25)) data = tibble::tibble(lon = runif(4),...
sieste's user avatar
  • 8,817
1 vote
1 answer
98 views

minimum number of unique values by row

I have a tibble with 10k rows and 10 columns of different ID strings. I am attempting to write a function similar to dplyr::distinct() which has a min_distinct numeric variable that would be a ...
NateN's user avatar
  • 65
1 vote
1 answer
39 views

Join tables based on a range instead of exact match [duplicate]

I have two datasets as the ones described below: dfA <- tibble( name = c("John", "Michael", "Brian", "Thomas", "Peter"), expected = c(128.34, ...
jpm92's user avatar
  • 152
1 vote
2 answers
83 views

Column binding vectors of unequal length in tidyverse

Below, I'm trying to col-bind the input to create a data.frame using the map_dfc() to acheive my Desired_output. But it looks like map_dfc() can only col-bind equally-lengthed vectors. So, I wonder ...
Simon Harmel's user avatar
  • 1,449
1 vote
4 answers
61 views

How can I combine to columns that consist of lists?

I want to combine the two columns position and . They look like this: position = c("123, 45", "67, 891, 23") and substitution = c("A/B, C/D", "E/F, G/H, J/K") ...
gernophil's user avatar
  • 220
1 vote
1 answer
76 views

replacing reshape2::decast() with tidyverse or R base

I was wondering if there is an equivalent for reshape2::dcast from tidyverse or even Base R in my code below to produce the same output below? library(reshape2) dat=structure(list(row = c("L2DA&...
Simon Harmel's user avatar
  • 1,449
0 votes
1 answer
714 views

`tidyr::unnest`: "cant't recycle input" error **ONLY** when using `cols = dplyr::everything()`

Consider the following: library(magrittr) sapply(c("dplyr", "tibble", "tidyr"), requireNamespace) mytbl <- structure( list( A = list(c("A.1", "A....
balin's user avatar
  • 1,626
0 votes
1 answer
51 views

Preserving decimal data format when writing r tibble data to .txt file

I am trying to write a tidyverse tibble to a text file while maintaining decimal format in the out put file, but all write functions seem to convert decimal data with quite a few significant digits. ...
nigus21's user avatar
  • 339
0 votes
1 answer
130 views

Mutate numerical column name with respect to another variable R

I have a tibble with the following structure: In that tibble there are a vast amount of lines, the ids are unique and for each one of them there is at least one value different from NA (in the column ...
Yesid Sánchez Arias's user avatar
1 vote
1 answer
53 views

R Why does a list of Tibble's display as a list of Tibble's and a vector of Tibble's displays as a individual columns of the Tibble?

R Why does a list of Tibble's display as a list of Tibble's and a vector of Tibble's displays as a individual columns of the Tibble? library(tidyverse) t1 <- tibble(num = 1:7, ll = letters[1:7]) ...
kmlewis15's user avatar
0 votes
1 answer
48 views

R saving workspace with save.image() turns tibbles into plain dataframes

in RStudio, I have around 100 objects mostly tibbles, 5GB total which are always loaded before our analysis workflow. I'd like to store them all as a single .Rdata or some other appropriate data ...
taiyodayo's user avatar
  • 359
0 votes
2 answers
203 views

writing a fomatted tibble to a tsv in R

The formatting tidyverse provides for tibbles is useful for displaying results in console. How can I export the tibble formatting to a .txt or .csv file? library(tidyverse) set.seed(123) df = ...
user36302's user avatar
  • 380
0 votes
2 answers
60 views

pivot_wider not giving desired output

I'm trying to get Hugo_Symbol as columns and each sample as row. but seem I'm not doing it right. could you please help? data looks like this library(tidyverse) df <- data.frame(Hugo_Symbol = ...
sahuno's user avatar
  • 433
1 vote
1 answer
60 views

R: Tibble multible conditions

Let's say I have a tibble in R that shows which fruit was eaten in which year how many times (n). year - fruit - n <dbl> <chr> <int> . . . 2001 Apple 201 2001 Ananas 50 2002 ...
8905t's user avatar
  • 21
1 vote
1 answer
160 views

Extract portion of nested tibbles?

I've got a pile of nested tibbles that are from the tidyrss package. The data looks like this: What I'm trying to do is take the four common items from each tibble and tidy them, so that the output ...
Christopher Penn's user avatar

15 30 50 per page
1
2 3 4 5
16