Skip to main content
Filter by
Sorted by
Tagged with
2 votes
1 answer
115 views

I have a data frame containing the specification for a set of regression models (regress_grid) with a column for different aspects of the model. I then use dplyr::rowwise() to estimate a model for ...
RichPatter's user avatar
4 votes
1 answer
102 views

Is it possible in some way to force the evaluation order in a {tidypolars} pipe? For example: install.packages("tidypolars", repos = c("https://community.r-multiverse.org", '...
crestor's user avatar
  • 1,558
4 votes
3 answers
184 views

I want to create a custom function for the collapse package where I supply unquoted grouping variables like so: library(collapse) library(tidyverse) fgroup_by_no_entries <- function(df, ...) { ...
user63230's user avatar
  • 4,901
1 vote
1 answer
58 views

I'm trying to write a function that would simply wrap around deparse() and substitute() like so: get_name <- function(x) { deparse(substitute(x)) } The point of get_name() is to return the ...
Harrison Jones's user avatar
0 votes
1 answer
60 views

Here is what I want to achieve library(dplyr) mtcars %>% dplyr::summarise( dplyr::across(mpg, ~ sum(.x) / sum(vs)) ) #> mpg #> 1 45.92143 if I have this function stored in an object, I ...
olivroy's user avatar
  • 849
0 votes
1 answer
58 views

I have a r script, named myrsciprt.R as follows: library(ggplot2) library(ggpubr) library(palmerpenguins) create_plots_pdf <- function(output_filename, group_name){ # Histogram example: ...
JustB's user avatar
  • 37
1 vote
1 answer
40 views

I am trying to create a plot function that can plot different colors for a column with factors if .f2=NULL, and an interaction of the .f1 and .f2 columns if the .f2 parameter is not NULL. The if ...
Robert's user avatar
  • 1,068
2 votes
1 answer
144 views

What I'm trying to do I'm attempting to write a function that uses dplyr verbs and that takes an "arrow open dataset" as the first argument, and a column in that dataset as the second ...
Avery Robbins's user avatar
2 votes
1 answer
93 views

I am trying to write a function in R for re-creating a ggplot graph. The graph is using climate data, and I want to be easily able to remake it for 3 different climate scenarios (rcp column) and ...
abby23's user avatar
  • 25
0 votes
1 answer
36 views

Below is a pmap() operation that requires my data to be in wide format. I perform a few simulations each day and capture the max value per simulation as post_max. library(tidyverse) POST_SIMS <- 2 ...
Joe's user avatar
  • 3,836
0 votes
1 answer
68 views

I'm trying to automate the production of .tex tables and I want to add in the add.lines section of stargazer a value called mean_outcome but I'm having trouble producing this value, I think I'm ...
Paula's user avatar
  • 701
2 votes
2 answers
2k views

Consider the following structure: tmp_data <- structure( list( currency = c("EUR", "USD"), funding = c(50, 700)), class = c("tbl_df", "tbl", "...
balin's user avatar
  • 1,706
2 votes
1 answer
149 views

I am trying to build a GET request one row at a time from a dataframe where the possible parameters are a varied and large list, and the dataframe I'm passing to the function may not have the ...
ScottyJ's user avatar
  • 1,117
1 vote
1 answer
87 views

Question Why do I get inconsistent error messages in R from a function that uses non-standard evaluation, and what is the best way to control this / write the function? Initial setup that works as ...
ScottyJ's user avatar
  • 1,117
0 votes
2 answers
473 views

I have data with multiple observable variables (say, x,y,z), indexed by another set of variables (sect, and item). Each time I run an experiment I get such a set of observations. So for experiment &...
postylem's user avatar
  • 1,121
0 votes
0 answers
35 views

I have a list of tables that I need to make using different variables, and I want to make a function that will let me make the tables differently each time by passing through different variables as ...
Tom's user avatar
  • 51
2 votes
1 answer
93 views

Disclaimer: this is a very elemental question. I'll use an example to make it easier, but the question has nothing to do with the example itself. Supose you have a dataframe df: # A tibble: 5 × 4 ...
Ricardo Semião's user avatar
0 votes
2 answers
313 views

id <- 1:30 x<-rnorm(30,1,10) y<-rnorm(30,1,10) data<-data.frame(id,x,y) add<-function(data, y_1, y_2){ data<-dplyr::mutate(data, ...
Tube's user avatar
  • 195
2 votes
2 answers
145 views

I have the following data: my_data <- structure(list(case_one = c("A", "B", "A", "B", "A", "B", "A", "B", "A&...
fschier's user avatar
  • 299
1 vote
1 answer
93 views

I have a function which is a wrapper around stringr::str_c(), and therefore receives any number of character vectors as input using the ... argument. The issue is that I would like to perform some ...
Matan Hakim's user avatar
1 vote
1 answer
121 views

Say I have this data: d <- msleep %>% mutate(comfort_color_desk = sample(c(0,1), replace=TRUE, size=nrow(msleep)), comfort_color_chair = sample(c(0,1), replace=TRUE, size=...
C.Robin's user avatar
  • 1,100
1 vote
1 answer
67 views

I am writing a function that makes ggplots with given data, and I am interested in setting a parameter that can call the different scales::label_* functions to change the outputs. For example, I want ...
mfg3z0's user avatar
  • 899
0 votes
1 answer
85 views

I am writing a function to join two datasets using dplyr::_join where the by terms are parameters passed in without quotes. I have seen quite a few solutions to this issue, but all seem to be dated ...
mfg3z0's user avatar
  • 899
1 vote
3 answers
244 views

I am trying to create a function and I want to reference a column I previously created inside the function with the {{}} and :=. How can I reference the "{{col}}_d" column? library(...
kmlewis15's user avatar
1 vote
1 answer
424 views

I want to modify a list of columns. Each column has a list of conditions that need to be applied with a case_when. I tried the following: df <- tibble(value=c("a","b","c&...
Julio's user avatar
  • 13

1
2 3 4 5
10