All Questions
232
questions
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),...
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 ...
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, ...
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 ...
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") ...
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&...
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....
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. ...
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 ...
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])
...
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 ...
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 = ...
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 = ...
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 ...
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 ...