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.
Questions tagged [tibble]
1309 questions
5
votes
3 answers
Access R Dataframe Values Rather than Tibble
I'm an experienced Pandas user and am having trouble plugging values from my R frame into a function.
The following function works with hard coded values
>seq.Date(as.Date('2018-01-01'), as.Date('2018-01-31'), 'days')
[1] "2018-01-01"…

Clem Manger
- 173
- 1
- 12
5
votes
5 answers
dplyr mutate a variable by comparing a variable and vectors of different sizes
I have the dataframe of the following type
df <- tibble::tribble(~x,
c("A", "B"),
c("A", "B", "C"),
c("A", "B", "C", "D"),
c("A", "B"))
and vectors like…

Geet
- 2,515
- 2
- 19
- 42
5
votes
2 answers
From tibble to txt or excel file in R
Hi all: I am working with tibbles to summarise my data and now I have a problem. I need to send the data I have in a tibble to a partner in an excel or csv file format. The thing is that it requires the csv (or excel) file to be in a specific…

Daniel Aviles
- 53
- 1
- 1
- 8
5
votes
1 answer
Why do mutate() and add_column() not accept the same basic arguments?
Often I wish to add a new column at a specific index; mutate() does not have a simple implementation of this, while add_column() does via .before and .after arguments. I would expect the two functions to behave the same in simple settings, but they…

Travis Gerke
- 344
- 1
- 10
5
votes
1 answer
Tibbles reject lubridate's duration and period objects
Code that works: duration and period objects
The following code successfully produces a duration object and a period object respectively.
> lubridate::as.duration(1)
[1] "1s"
> lubridate::seconds(1)
[1] "1S"
Code that doesn't work: duration and…
user3646834
5
votes
2 answers
Find adjacent rows that match condition
I have a financial time series in R (currently an xts object, but I'm also looking into tibble right now).
How do I find the probability of 2 adjacent rows matching a condition?
For example I want to know the probability of 2 consecutive days…

TommyF
- 6,660
- 8
- 37
- 61
5
votes
3 answers
How to return the col type of a R tibble in compact string representation?
For example I have a tibble like this.
test <- tibble(a = 10, b = "a")
with this input, I want a function that can return "dc" which represent double and character.
The reason I ask this is that I want to read in lots of files. and I don't want to…

wei
- 111
- 1
- 9
4
votes
4 answers
Range calculation by row in R
I have a 4x4 tibble, and I'm practicing various dplyr functions on it.
I would like to calculate the range of each row, and display the range of that row as a single number in a new column.
Here is my code:
my_tibble <- data.frame(col1 = c(1:5),…

Stabilo Boss
- 45
- 4
4
votes
3 answers
join list of data frames in one dataframe
I have the following list of tibbles:
list(structure(list(comp_levels = c("C1-C", "C2-C", "C3-C", "C4-C",
"C5-C"), pval = c(0.766639095524166, 0.937892422573886, 0.771590751986251,
0.0650891911214325, 0.998166537304179), sig_t0 = c(NA_character_,…

Wilson Souza
- 830
- 4
- 12
4
votes
2 answers
How to transform one row list of tibbles into list of vectors
I have this list with 5 tibbles that each consist of one row:
>[5]>
[[1]]
# A tibble: 1 x 4
one two three four
1 …

TarJae
- 72,363
- 6
- 19
- 66
4
votes
2 answers
How to rename multiple observations?
I have a tibble with three columns in r. One of the columns are "week_days". All the observations in this column are abbreviated like this: (mo,tu,we,th,fr,sa,su). Though I want to change them to (monday, tuesday... and so on).
any idea on how I can…

Chrisabe
- 65
- 5
4
votes
3 answers
Cleaner way to replace values in a tibble list
I’m trying to come up with a cleaner way (less typing) to replace values in lists in a large tibble. From looking around online, it seems common to use subsetting rather than $ to replace values, like this:
mtcars["cyl"][mtcars["cyl"] == 4] <- 6
I…

ajt10
- 45
- 3
4
votes
1 answer
Is it possible to name a column of a tibble using a variable containing a character vector (string)?
Is there a way to name the column of a tibble using a variable? I want to name the first column below Clade for example. I tried paste() and assign(), but neither function seems to do what I want.
CLADE_FIELD = "Clade"
LINEAGE_FIELD = "Lineage"
…

Lia_G
- 145
- 1
- 8
4
votes
2 answers
rownames_to_column does not work after rowwise() properly
I have this df:
df <- structure(list(a = 1:5, b = 6:10, c = 11:15, d = c("a", "b",
"c", "d", "e"), e = 1:5), row.names = c(NA, -5L), class = c("tbl_df",
"tbl", "data.frame"))
a b c d e
1 1…

TarJae
- 72,363
- 6
- 19
- 66
4
votes
4 answers
Search for string across entire row of a tibble?
I'm trying to clean up a sample information sheet that comes from a lot of different groups and thus the treatment information I care about may be located in any number of different columns. Here's an abstracted example:
sample_info = tribble(
…

GenesRus
- 1,057
- 6
- 16