tidyselect

Error in inDL(x, as.logical(local), as.logical(now), …) : unable to load shared object

烈酒焚心 提交于 2020-06-17 14:51:46
问题 I'm having this error when trying to attach package tidyselect and when trying to call tidyselect::any_function . The error happens in Rstudio or command line alike, in RStudio it is triggered as soon as I type: tidyselect:: , though ?tidyselect:: works fine and I can call the help of ?tidyselect::any_function . This also works: packageVersion("tidyselect") # [1] ‘0.2.4 It used to work, and I don't understand what changed, I just know package rjava has been installed, the admins might also

Can you list an exception to tidyselect `everything()`

末鹿安然 提交于 2020-01-06 05:17:09
问题 library(tidyverse) iris %>% as_tibble() %>% select(everything()) #> # A tibble: 150 x 5 #> Sepal.Length Sepal.Width Petal.Length Petal.Width Species #> <dbl> <dbl> <dbl> <dbl> <fct> #> 1 5.1 3.5 1.4 0.2 setosa #> 2 4.9 3 1.4 0.2 setosa #> 3 4.7 3.2 1.3 0.2 setosa #> 4 4.6 3.1 1.5 0.2 setosa #> 5 5 3.6 1.4 0.2 setosa #> 6 5.4 3.9 1.7 0.4 setosa #> 7 4.6 3.4 1.4 0.3 setosa #> 8 5 3.4 1.5 0.2 setosa #> 9 4.4 2.9 1.4 0.2 setosa #> 10 4.9 3.1 1.5 0.1 setosa #> # ... with 140 more rows Say I want

Excluding multiple columns based on unquote-splicing (!!!)

ぃ、小莉子 提交于 2020-01-02 05:14:08
问题 Trying to exclude multiple columns in a call to tidyr::gather() which are served as inputs to my function via a character vector argument (output of shiny::selectInput ) instead of via ... in a programmatic way How would I do that with tidy eval functionality? Since I pass multiple column names via a single function argument, I thought I needed to use !!! (unquote-splicing) instead of !! as layed out in Programming with dplyr. But that doesn't seem to play nicely with tidyselect::vars_select(

Unable to use tidyselect `everything()` in combination with `group_by()` and `fill()`

混江龙づ霸主 提交于 2019-12-07 18:33:42
问题 library(tidyverse) df <- tibble(x1 = c("A", "A", "A", "B", "B", "B"), x2 = c(NA, 8, NA, NA, NA, 5), x3 = c(3, 6, 5, 9, 1, 9)) #> # A tibble: 6 x 3 #> x1 x2 x3 #> <chr> <dbl> <dbl> #> 1 A NA 3 #> 2 A 8 NA #> 3 A NA 5 #> 4 B NA 9 #> 5 B NA 1 #> 6 B 5 9 I have groups 'A' and 'B' shown in column x1 . I need the 'NA' values in columns x2 and x3 to populate only from values within the same group, in the updown direction. That's simple enough, here's the code: df %>% group_by(x1) %>% fill(c(x2, x3),

Unable to use tidyselect `everything()` in combination with `group_by()` and `fill()`

陌路散爱 提交于 2019-12-06 08:03:42
library(tidyverse) df <- tibble(x1 = c("A", "A", "A", "B", "B", "B"), x2 = c(NA, 8, NA, NA, NA, 5), x3 = c(3, 6, 5, 9, 1, 9)) #> # A tibble: 6 x 3 #> x1 x2 x3 #> <chr> <dbl> <dbl> #> 1 A NA 3 #> 2 A 8 NA #> 3 A NA 5 #> 4 B NA 9 #> 5 B NA 1 #> 6 B 5 9 I have groups 'A' and 'B' shown in column x1 . I need the 'NA' values in columns x2 and x3 to populate only from values within the same group, in the updown direction. That's simple enough, here's the code: df %>% group_by(x1) %>% fill(c(x2, x3), .direction = "updown") #> # A tibble: 6 x 3 #> x1 x2 x3 #> <chr> <dbl> <dbl> #> 1 A 8 3 #> 2 A 8 5 #>

Mutate multiple variable to create multiple new variables

泄露秘密 提交于 2019-11-27 16:13:27
Let's say I have a tibble where I need to take multiple variables and mutate them into new multiple new variables. As an example, here is a simple tibble: tb <- tribble( ~x, ~y1, ~y2, ~y3, ~z, 1,2,4,6,2, 2,1,2,3,3, 3,6,4,2,1 ) I want to subtract variable z from every variable with a name starting with "y", and mutate the results as new variables of tb. Also, suppose I don't know how many "y" variables I have. I want the solution to fit nicely within tidyverse / dplyr workflow. In essence, I don't understand how to mutate multiple variables into multiple new variables. I'm not sure if you can

dplyr::select() with some variables that may not exist in the data frame?

旧城冷巷雨未停 提交于 2019-11-27 05:54:42
问题 I have a helper function (say foo() ) that will be run on various data frames that may or may not contain specified variables. Suppose I have library(dplyr) d1 <- data_frame(taxon=1,model=2,z=3) d2 <- data_frame(taxon=2,pss=4,z=3) The variables I want to select are vars <- intersect(names(data),c("taxon","model","z")) that is, I'd like foo(d1) to return the taxon , model , and z columns, while foo(d2) returns just taxon and z . If foo contains select(data,c(taxon,model,z)) then foo(d2) fails

Mutate multiple variable to create multiple new variables

Deadly 提交于 2019-11-26 11:37:31
问题 Let\'s say I have a tibble where I need to take multiple variables and mutate them into new multiple new variables. As an example, here is a simple tibble: tb <- tribble( ~x, ~y1, ~y2, ~y3, ~z, 1,2,4,6,2, 2,1,2,3,3, 3,6,4,2,1 ) I want to subtract variable z from every variable with a name starting with \"y\", and mutate the results as new variables of tb. Also, suppose I don\'t know how many \"y\" variables I have. I want the solution to fit nicely within tidyverse / dplyr workflow. In