EN VI
Posts (0)
Questions (5)
2024-03-11 08:00:06
Regular expressions can be used starting with ^ and ending with $ matching [0-9] to match any digit from 0-9, and [1-4] if you just want to match 1 to 4. Use .* to match anything. df % filter(gre...
Tags: r dplyr grepl
2024-03-11 22:30:06
If I understand the problem correctly, this is easily accomplished using the dplyr package, as follows: First group() the dataset by week, to allow the computations be done week by week. Create addit...
Tags: r dplyr
2024-03-12 22:30:05
library(tidyverse) set.seed(12) data_table % mutate(mean_a = mean(a)) %>% ungroup() %>% distinct(mean_a, {{grouped_var}}) } # Define test data and arguments data % # Unquote the argu...
Tags: function dplyr arguments
2024-03-15 23:00:04
rowwise is a pretty slow operation in dplyr, even for moderately sized data frames. One possibility is to iterate in parallel over time and the row number and simply select the value: library(dplyr) l...
Tags: r dplyr
2024-03-17 22:00:05
With separate_rows(): library(tidyverse) param_file mutate(value = str_squish(value)) year % filter(variable == "year") %>% pull(value) version % filter(variable == "version") %>% pull(value) me...
Tags: r dplyr

Login


Forgot Your Password?

Create Account


Lost your password? Please enter your email address. You will receive a link to create a new password.

Reset Password

Back to login