Questions tagged [tibble]

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.

1309 questions
0
votes
2 answers

Finding duplicate observations of selected variables in a tibble

I have a rather large tibble (called df.tbl with ~ 26k rows and 22 columns) and I want to find the "twins" of each object, i.e. each row that has the same values in column 2:7 (date:Pos). If I use: inner_join(df.tbl, ~ df.tbl[i,], by = c("date",…
0
votes
0 answers

R add_row fails when used in a function

Here is a simple function I wrote to help troubleshoot an issue. I have a function whose purpose is to return a tibble. tstFunc <- function(n){ n <- tibble(style = character(), color = character(), count = integer()) add_row(n, style =…
Charles Knell
  • 117
  • 1
  • 9
0
votes
1 answer

error specified index is not a column of x (as_tbl_time)

I am trying to use as_tbl_time but I am receiving the error in the title. library(tidyverse) library(lubridate) dates <- c("01/01/18 1:01:10 PM" ,"01/01/18 1:10:10 PM") vals <- c(100, 200) df <- data.frame(dates, vals) df$dates <-…
George
  • 5,808
  • 15
  • 83
  • 160
0
votes
1 answer

How to automate the creation of histograms in R, saving the result in a list of hist() objects?

I have a code to process data, and I need to save some histograms that I will use in a Shiny application. What I need is basically automate the creation of histograms, saving the result in a list of hist() objects, that I will save in an RDS file…
0
votes
0 answers

Pivot-like transformation of a tibble?

I have a... # A tibble: 6 x 10 CCG18CD CCG18CDH CCG18NM STP18CD STP18NM LAD18CD LAD18NM PCON16CD PCON16NM Dummy
RHinks
  • 41
  • 5
0
votes
0 answers

Shiny R GGplot Barplot showing wrong values when dataset it's based on shows correct one

I have a shinydashboard app where I want to be able to reactively subset data by multiple variables and then create a barplot of the resulting subset. I've successfully created the reactive subsetting but the barplot shows, every time, that the y…
Heather
  • 129
  • 1
  • 11
0
votes
1 answer

Creating a new variable while looping over rows in a tibble

I have been delving into the whole tidyverse ecosystem (just a little bit) and I have been wondering how to solve the follwing problem with it. More in general, I have been wondering how to write custom functions in transmute which deal with (loops…
Jean_N
  • 489
  • 1
  • 4
  • 19
0
votes
0 answers

Keep Case Names in Regresson Object when plotting from a Tibble

From the setNames help in R: x <- 1:20 y <- setNames(x + (x/4 - 2)^3 + rnorm(20, sd = 3), paste("O", x, sep = ".")) ww <- rep(1, 20); ww[13] <- 0 summary(lmxy <- lm(y ~ x + I(x^2)+I(x^3) + I((x-10)^2), weights = ww), cor =…
Tony2016
  • 247
  • 2
  • 11
0
votes
2 answers

Replace NA with grouped means in R?

I am stuck at trying to replace NAs with means and I would be very grateful for help. I want to replace NAs in multiple columns of a dataframe with the mean of a group within the column. In the example below I would want to replace the NA in x1 with…
cholz
  • 83
  • 2
  • 12
0
votes
1 answer

How to broom::glance or summarize several phylogenetic gls and save as tibble?

I have several phylogenetic GLS and would like to find a better way to summarize the results. I am not using loops to obtain several PGLS since I will be clumping several traits from different matrices. Example below: library(caper) # for the pgls…
Andrés Parada
  • 319
  • 7
  • 21
0
votes
1 answer

R Anomalize Package with Monthly data not working

I'm replicating the examples in theR Anomalize package home page but is appears that once I replace the daily sample data to Monthly, the code breaks. Below is the code I use that generated the below error: # load necessary…
0
votes
1 answer

How to print milliseconds in dttm object

ex <- structure(list(rowid = 1:12, timestamp = structure(c(1505577931.8, 1505577931.8, 1505577931.8, 1509206767.39, 1509206767.39, 1511019574.47, 1511019574.47, 1511988378.544, 1511988378.544, 1511986281.239, 1511986281.239, 1512909143.7), class…
jakes
  • 1,964
  • 3
  • 18
  • 50
0
votes
1 answer

Innerjoin results in empty tibble in R

I have two tibbles (spain and canada) with equivalent keys and I'm trying to join them by 'Country'. Here's what they look like: Country stratum oecd schoolID studentID booklet q q_1 q_2 q_3 q_4 …
Leena
  • 21
  • 1
  • 4
0
votes
1 answer

dplyr select outputs error "Error: Can't assign an integer vector to a list of quosures"

I guess I updated one of the libraries and now dplyr's select dose't work. any ideas which library do reinstall and which version to avoid conflicts? x <- data.frame(a=c(1,2,3),b=c(1,2,3)) dplyr::select(x,a) Error: Can't assign an integer vector…
0
votes
1 answer

R code: How can I extract a column from a list of tibbles and use it as a parameter for functions?

I have a list of 9 tibbles called CCLF_Details. Each Tibble is named CCLF1_Details-CCLF9_Details. I have columns "COLUMN_LABEL" and "COLUMN_WIDTH" in each tibble. I want to use those columns as parameters for read_fwf. So far I've done width <-…
user3304359
  • 335
  • 1
  • 9