similar to: Adding columns to a tibble based on a value in a different tibble

Displaying 20 results from an estimated 6000 matches similar to: "Adding columns to a tibble based on a value in a different tibble"

2023 Nov 04
1
Adding columns to a tibble based on a value in a different tibble
I think a simple reproducible example ("reprex") may be necessary for you to get a useful reply. Questions with vague specifications such as yours often result in going round and round with attempts to clarify what you mean without a satisfactory answer. Clarification at the outset with a reprex may save you and others a lot of frustration. Cheers, Bert On Sat, Nov 4, 2023 at 1:41?AM
2017 Nov 28
0
dplyr - add/expand rows
On 11/26/2017 08:42 PM, jim holtman wrote: > try this: > > ########################################## > > library(dplyr) > > input <- tribble( > ~station, ~from, ~to, ~record, > "07EA001" , 1960 , 1960 , "QMS", > "07EA001" , 1961 , 1970 , "QMC", > "07EA001" , 1971 , 1971 ,
2017 Nov 27
2
dplyr - add/expand rows
try this: ########################################## library(dplyr) input <- tribble( ~station, ~from, ~to, ~record, "07EA001" , 1960 , 1960 , "QMS", "07EA001" , 1961 , 1970 , "QMC", "07EA001" , 1971 , 1971 , "QMM", "07EA001" , 1972 , 1976 , "QMC", "07EA001" , 1977 ,
2017 Nov 28
2
dplyr - add/expand rows
Or with the Bioconductor IRanges package: df <- with(input, DataFrame(station, year=IRanges(from, to), record)) expand(df, "year") DataFrame with 24 rows and 3 columns station year record <character> <integer> <character> 1 07EA001 1960 QMS 2 07EA001 1961 QMC 3 07EA001 1962 QMC 4
2017 Nov 26
3
dplyr - add/expand rows
dplyr may have something for this, but in base R I think the following does what you want. I've shortened the name of your data set to 'd'. i <- rep(seq_len(nrow(d)), d$YEAR_TO-d$YEAR_FROM+1) j <- sequence(d$YEAR_TO-d$YEAR_FROM+1) transform(d[i,], YEAR=YEAR_FROM+j-1, YEAR_FROM=NULL, YEAR_TO=NULL) Bill Dunlap TIBCO Software wdunlap tibco.com On Sat, Nov 25, 2017 at 11:18 AM,
2023 Oct 17
1
transform a list of arrays to tibble
Arnaud, Short answer may be that the tibble data structure will not be supporting row names and you may want to simply save those names in an additional column or externally. My first thought was to simply save the names you need and then put them back on the tibble. In your code, something like this: save.names <- names(my.ret.lst) result.tib <- as_tibble_col(unlist(my.ret.lst),
2017 Nov 26
0
dplyr - add/expand rows
To David W.'s point about lack of a suitable reprex ("reproducible example"), Bill's solution seems to be for only one station. Here is a reprex and modification that I think does what was requested for multiple stations, again using base R and data frames, not dplyr and tibbles. First the reprex with **two** stations: > d <- data.frame( station =
2024 Apr 18
1
Tidyverse/dplyr solution for filling values of a tibble/dataframe from a column with a nested list.
Hi experts. I have a tibble? with a column containing a nested list (<list<list<double>>>? data type to be specific). Looks something like the following (but in R/Arrow? format): ID Nestedvals 001 [[1]](1,0.1)[[2]](2,0.2)[[3]](3,0.3)[[4]](4,0.4)[[5]](5,0.5) 002 [[1]](1,0.1)[[2]](2,0.2)[[3]](3,0.3)[[4]](4,0.4) 003 [[1]](1,0.1)[[2]](2,0.2)[[3]](3,0.3) 004 [[1]](1,0.1)[[2]](2,0.2)
2017 Nov 29
0
dplyr - add/expand rows
Hi, A benchmarking study with an additional (data.table-based) solution. Enjoy! ;) Cheers, Denes -------------------------- ## packages ########################## library(dplyr) library(data.table) library(IRanges) library(microbenchmark) ## prepare example dataset ########### ## use Bert's example, with 2000 stations instead of 2 d_df <- data.frame( station =
2017 Nov 29
2
dplyr - add/expand rows
On 11/29/2017 04:15 PM, T?th D?nes wrote: > Hi, > > A benchmarking study with an additional (data.table-based) solution. I don't think speed is the right benchmark (I do agree that correctness is!). For the R-help list, maybe something about least specialized R knowledge required would be appropriate? I'd say there were some 'hard' solutions -- Michael (deep
2017 Feb 12
1
Problems installing tibble (ggplot2) in R running Ubuntu 14.04
On 12 February 2017 at 12:28, Jeroen Ooms wrote: | On Mon, Dec 19, 2016 at 2:27 PM, Terje J?rgensen <terjej at imr.no> wrote: | > Hi, | > | > I am unable to install tibble, a required package for ggplot2 in R. I am | > running R (version 3.3.2 ) in RStudio (version 1.0.44). My OS is ubuntu | > 14.04 (64 bits). | | I was able to reproduce this problem. What happened is that
2017 Aug 14
2
tidyverse repeating error: "object 'rlang_mut_env_parent' not found"
Thanks for the feedback Jeff. Before I pursue a bug report, let me give a full example: ###### begin console output R version 3.4.1 (2017-06-30) -- "Single Candle" Copyright (C) 2017 The R Foundation for Statistical Computing Platform: i386-w64-mingw32/i386 (32-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions.
2016 Dec 19
4
Problems installing tibble (ggplot2) in R running Ubuntu 14.04
Hi, I am unable to install tibble, a required package for ggplot2 in R. I am running R (version 3.3.2 ) in RStudio (version 1.0.44). My OS is ubuntu 14.04 (64 bits). I get the same error when running R from the terminal. Any help would be gretly appreciated. Kind regards, Terje **************** Error messages: **************** install.packages("tibble") Installing package into
2023 Oct 17
1
transform a list of arrays to tibble
I work with a list of crypto assets daily closing prices in a xts class. Here is a limited example: asset.xts.lst <- list(BTCUSDT = structure(c(26759.63, 26862, 26852.48, 27154.15, 27973.45), dim = c(5L, 1L), index = structure(c(1697068800, 1697155200, 1697241600, 1697328000, 1697414400), tzone = "UTC", tclass = "Date"), class = c("xts", "zoo")), ETHUSDT
2017 Nov 29
0
dplyr - add/expand rows
Hi Martin, On 11/29/2017 10:46 PM, Martin Morgan wrote: > On 11/29/2017 04:15 PM, T?th D?nes wrote: >> Hi, >> >> A benchmarking study with an additional (data.table-based) solution. > > I don't think speed is the right benchmark (I do agree that correctness > is!). Well, agree, and sorry for the wording. It was really just an exercise and not a full
2017 Aug 14
4
tidyverse repeating error: "object 'rlang_mut_env_parent' not found"
UseRs, When doing some data manipulations using the tidyverse, I am repeatedly getting the same error message in now three separate situations. I can write up a reproducible example, but want to lay out the high-level issues in case someone recognizes exactly what is happening here. The error is: Error in mut_env_parent(overscope$.top_env, lexical_env) : object 'rlang_mut_env_parent'
2017 Nov 28
1
dplyr - add/expand rows
Bert wrote ... Bill's solution seems to be for only one station. No, it works for any number of stations. Bill Dunlap TIBCO Software wdunlap tibco.com On Sun, Nov 26, 2017 at 11:10 AM, Bert Gunter <bgunter.4567 at gmail.com> wrote: > To David W.'s point about lack of a suitable reprex ("reproducible > example"), Bill's solution seems to be for only one
2017 Aug 14
0
tidyverse repeating error: "object 'rlang_mut_env_parent' not found"
This sounds an awful lot like a bug. Read the Posting Guide to know what to do about bugs. And delaying making the reprex is _always_ a bad idea. -- Sent from my phone. Please excuse my brevity. On August 14, 2017 7:26:32 AM PDT, "Szumiloski, John" <John.Szumiloski at bms.com> wrote: >UseRs, > >When doing some data manipulations using the tidyverse, I am repeatedly
2017 Aug 14
0
tidyverse repeating error: "object 'rlang_mut_env_parent' not found"
> On Aug 14, 2017, at 8:37 AM, Szumiloski, John <John.Szumiloski at bms.com> wrote: > > Thanks for the feedback Jeff. Before I pursue a bug report, let me give a full example: > > ###### begin console output > > R version 3.4.1 (2017-06-30) -- "Single Candle" > Copyright (C) 2017 The R Foundation for Statistical Computing > Platform:
2020 Jul 10
2
Strange behaviour of methods::slot() when returning a tibble
I have an S4 object class defined in a Bioconductor package which contains multiple slots, some of which are tibbles, whilst others are vectors. If I call slot(object, name) where 'name' is an slot that contains a vector, everything works as expected. However, when I call slot(object, name) where 'name' is an slot that contains a tibble I get the following warning: Warning