tidyverse Questions

5

Solved

I have a dataset like this: data <- read.csv(text = "foo,bar a,b a,a b,c c,a c,b") I want to compute a table that tells me in how many rows every possible value appears, so something ...
Honewort asked 20/4, 2023 at 13:0

1

I study R with R Cookbook 2nd edition. in 4.6 Reading Fixed-Width Records, I typed code as written in book. but my code doesn't work like book Fisher R.A. 1890 1962 Pearson Karl 1857 1936 Cox Gertr...
Truesdale asked 24/8, 2021 at 8:25

6

Solved

I have the following data frame that looks like this (3 columns as list). A tibble: 14 x 4 clinic_name drop_in_hours appointment_hours services <chr> <list> <list> <list&gt...
Imagination asked 29/12, 2017 at 14:42

6

I have the following list of list. It contains two variables: pair and genes. The contain of pair is always vector with two strings. And the variable genes is a vector which can contain more than 1...
Joslin asked 2/8, 2017 at 5:17

1

In this SO Question bootstrapping by several groups and subgroups seemed to be easy using the broom::bootstrap function specifying the by_group argument with TRUE. My desired output is a nested ti...
Middle asked 4/10, 2019 at 10:18

6

Solved

Here is my toy dataframe. df <- tibble::tribble( ~var1, ~var2, ~var3, ~var4, ~var5, ~var6, ~var7, "A", "C", 1L, 5L, "AA", "AB", 1L, "A", "C", 2L, 5L, "BB", "AC", 2L, "A", "D", 1L, 7L, "AA",...
Diao asked 1/11, 2018 at 20:2

1

Solved

I would like to do a resampling on a dataset by group (name column). For example: names <- c(rep("a", 3), rep("b", 3), rep("c", 3)) test <- tibble(name = names,...
Underhill asked 16/3, 2023 at 0:17

10

I frequently need to recode some (not all!) values in a data frame column based off of a look-up table. I'm not satisfied by the ways I know of to solve the problem. I'd like to be able to do it in...
Proceed asked 13/4, 2021 at 19:50

3

Solved

Another seemingly easy task where purrr::map2 is giving me a hard time. I have a list of data frames and I have a vector of column names. I now want to rename a certain column in each of the data f...
Stalag asked 6/3, 2023 at 8:0

2

Solved

Warning in install.packages : installation of package ‘googledrive’ had non-zero exit status ERROR: dependencies ‘curl’, ‘gargle’, ‘googledrive’, ‘httr’, ‘ids’ are not available for package ‘googl...
Violette asked 20/9, 2021 at 18:38

5

Solved

strong textI keep encountering problems with installing tidyverse package, which preventing me from implementing many text processing tasks. The problem is the same as those mentioned in many previ...
Flacon asked 28/2, 2020 at 12:40

3

Solved

I have a data frame that looks like this. It contains the sunflower seed productivity of each country. I want to add next to this data polygon data so I can plot it with ggplot2. I was told to use ...
Gypsum asked 20/1, 2023 at 13:40

4

Solved

I have a large dataset that looks like this. I was wondering if there is a clever way to apply a t-test, in each row, aka gene, and compare the counts between humans and mice. I want to compete in ...
Selene asked 15/1, 2023 at 17:45

5

Solved

When doing data analysis, I sometimes need to recode values to factors in order to carry out groups analysis. I want to keep the order of factor same as the order of conversion specified in case_wh...
Brobdingnagian asked 30/3, 2018 at 10:5

2

Solved

I have a tibble that includes some list-columns. library(dplyr) df <- structure( list(ID = 1:5, V1 = list(1.71, -0.59, 0.73, -0.93, 0.18), V2 = list(-0.08, c(0.59, 0.87), -1.87, -1.38, 0.83),...
Sick asked 13/1, 2023 at 14:29

2

When I load tidyverse [or type tidyverse_conflicts()] a warning message appears telling me there is a conflict between two functions dplyr::filter() and dplyr::lag(). How can we avoid such conflict...
Akin asked 12/8, 2022 at 15:38

2

Solved

I'd like to use mutate function from the tidyverse to create a new column based on the old column using only a data frame and strings, which represent column headers, as inputs. I can get this to...
Valence asked 30/3, 2018 at 14:29

3

I want to find rows in a dataset where the values in all columns, except for one, match. After much messing around trying unsuccessfully to get duplicated() to return all instances of the duplicate...
Enlarger asked 12/7, 2018 at 10:1

3

Solved

EDIT: The accepted answer has helped the scales fall from my eyes; this change is an improvement and not annoying after all. In the help file for table, it is now written: Non-factor arguments ...
Captivity asked 28/6, 2017 at 12:50

3

Solved

I have the following strings: x <- "??????????DRHRTRHLAK??????????" x2 <- "????????????????????TRCYHIDPHH" x3 <- "FKDHKHIDVK????????????????????TRCYHIDPHH" x4...
Brahms asked 11/11, 2022 at 1:29

2

I am working with cost data for a retailer, where I am making some predictions using gam that look as follows (sample data, self-generated). The GAM fits values in the middle, but has some NAs at t...
Stationmaster asked 25/10, 2022 at 14:49

3

Solved

tidyr::fill() isn't filling values in my tibble. Here is a reprex: library(tidyverse) library(googlesheets4) url <- "https://docs.google.com/spreadsheets/d/1q5gdePANXci8enuiS4oHUJxcxC13d6bjMRS...
Chromato asked 1/5, 2020 at 23:1

3

I have the following function, which basically check for percentage of the matching positions of two strings: library(tidyverse) calculate_sequ_identity <- function(sequ_1 = NULL, sequ_2 = NULL)...
Juanjuana asked 20/10, 2022 at 5:37

6

Solved

I want to select columns and rename them based on the names of the columns which I keep in a separate dataframe. This is the original dataset: df <- tribble( ~year, ~country, ~series1, ~series2...
Wapiti asked 19/10, 2022 at 14:47

3

Solved

I would like to obtain a generic formula to arrange dataframes with a varying number of columns. For example, in this case the dataframe contains "categ_1, categ_2, points_1, points_2": ...
Reunion asked 4/10, 2022 at 6:39

© 2022 - 2025 — McMap. All rights reserved.