All Questions
10,033
questions
2
votes
1
answer
29
views
R: Efficient way to str_replace_all without recursively replacing conflicting substitutions?
Update:
Elegant solution discovered
Embarrassingly, I discovered a pretty elegant solution to the original problem shortly after posting it. I wonder why this didn't pop up in my initial googling...
...
0
votes
0
answers
34
views
strip.white doesn't work in r if the data frame is too large
I import, clean, and merge two different data sets that are created from Qualtrics surveys. I use read.csv to load the data, and I have strip.white=TRUE to remove leading and trailing spaces. If I ...
0
votes
3
answers
26
views
Using 'slice_max()' in for loop
I'm trying to create new dataframes with the top three values for each column across a dataframe.
probUnweighted <- data.frame(
Sample1 = c(0.9, 0.2, 0.03, 0.1, 0.5, 0.09),
Sample2 = c(0.045, 0.11,...
1
vote
0
answers
37
views
How to aggregate data within the multiverse package in R
I want to perform a multiverse analysis using the multiverse package.
I have many different filters and data transformations to take into account the multiverse analysis.
One of them is the different ...
0
votes
0
answers
11
views
Issue with colorspace Package when Loading ggplot2 in tidyverse using renv
I have used tidyverse and renv together for a long time, but recently I started getting an error I have been unable to resolve. The error suggest that colorspace package is failing in some way when ...
0
votes
1
answer
33
views
Remove string from column across group of rows in another column
I would like to remove a string from one column across a group of rows in another column. In the below reprex, I would like to remove the string in snippet from the string in text in any row in the ...
1
vote
2
answers
23
views
How to select specific columns across multiple dataframes in R and then bind them into one data.frame?
I am trying to select or subset multiple data frames with different number of columns. They all contain the same columns of interest, so I am trying to make them all contain the same columns so I can ...
1
vote
2
answers
42
views
Recode relationship matrices based on new subgrouping
Problem:
I have a survey dataset which includes intra-household relationships. I had to subdivide household into tax-unit, which means I need to redefine the relationship matrices based on the new tax-...
0
votes
1
answer
26
views
additional arguments to purrr:map don't work as expected
I'm using the purrr::map function to iterate over several columns and tidy the result. for a short example, I provide the following code:
library(tidymodels)
library(broom)
> penguins %>%
+ ...
2
votes
2
answers
50
views
Trying to create a grouped barchart in R - producing a stacked one instead
I am trying to create a bar chart that has the number of each species grouped into years. I want each year represented on the x axis with the number of each of the 3 species grouped next to one ...
0
votes
1
answer
24
views
Propensity density score with MatchIt package -- how to bind rows when we have lot of datasets to have a final dataset with matched characteristics
I'm expanding this post -- answered by @edwards (Thanks).
I'm working with panel data. We assessed children in 2019, 2020, 2021 and 2022. Therefore, I have four datasets (2019, 2020, 2021, and 2022). ...
0
votes
1
answer
47
views
Name nested column list with specific name
This is my code
library(tidyverse)
# Criar um dataframe de exemplo com dados de futebol
dat <- tibble(
continent = rep(c("Asia", "Europe", "Africa", "Americas&...
1
vote
1
answer
52
views
Using for loops, while, tidyverse, or packages to create a dataset with matching characteristics from a previous one (sampling) [closed]
I'm working with panel data. We assessed children in 2019 and 2020. Therefore, I have two datasets (2019 and 2020) and I want to create a third dataset matching the data from the second dataset (2020) ...
4
votes
5
answers
98
views
Convert a list into a tibble with nested columns
I would like to convert a list like this into a tibble.
lst <- list(
"A"=list(
"Category"="A",
"Team"=c("x"),
"City"="...
0
votes
2
answers
52
views
Loop through variables to filter a tibble in R
This feels like it should be easier than it is but here we go. I have a data frame that looks like this:
to.csv = structure(list(geography = c("030223131022122122", "030223131220201023&...