Questions tagged [tidyverse]

ONLY use this tag if your question relates to the installation, integration with your system, or inclusion of the entire tidyverse library. DO NOT USE if your question relates to one or two components of the tidyverse, such as dplyr or ggplot2. Use *those* tags, and tag with `r` as well for a better response.

tidyverse is an R package that installs a number of other packages for data processing and graphics.

Unless your question is about the entirety of the tidyverse package, its installation or its integration with your system, use tags for the packages you are actually using. Using library(tidyverse) is rarely a minimal reproducible example when only library(dplyr) is required.

See https://www.tidyverse.org/packages/ for a breakdown of the packages contained in tidyverse and their respective functions.

Repositories

Resources

Vignettes

Related tags

9739 questions
2
votes
1 answer

How can I display a ggplot with multiple values on the X axis?

Basically this is what I'm going for: My data however is in this format: Country Response Spain No France Yes France No France Yes UK Yes and basically would want to sum the "No" and "Yes" responses for each countryy
2
votes
1 answer

Tracking observations across different datasets (e.g. sub-reddits)

I have three datasets from three different sub-reddits, and my goal is 1-to check how many users are active in df1 (i.e. a sub-reddit), active in df2, and/or df3 (i.e. another subreddit). Another goal is that once I merge all datasets, I am able to…
maldini1990
  • 279
  • 2
  • 11
2
votes
1 answer

R: Summarise values per column and modify values not belonging to the most abundant entries

I am trying to summarize values for multiple columns in a dataframe and then change the names of whichever entries fall outside of the top 2 most abundant entries. I have the following example dataframe: df <- data.frame( row.names = c("10", "20",…
Kak Schoen
  • 364
  • 2
  • 18
2
votes
5 answers

How to count number of values in columns based on a category in R?

Suppose we have a data frame df like book_id book_category book_word_hi book_word_bye book_word_yes 1 drama 3 0 4 2 action 1 4 5 3 drama 5 3 …
HelpMe
  • 87
  • 1
  • 8
2
votes
2 answers

How to infer missing values in a R data frame from other rows that have the data?

In my example I have a table with products that have a unique ID in Store 1 and a different (but also unique) ID in Store 2. As a rule, the same product has always the same ID in store 1 and always the same ID in store 2. i.e. if I know only one of…
mandmeier
  • 355
  • 5
  • 16
2
votes
1 answer

Adding a straight line to a qqnorm plot

I have the following code: IDRTlme <- lme(Score ~ Group + Condition + Group*Condition, random = ~ 1|ID, data = IDRTnew) I then enter the following to display a qq-plot to check for normality: qqnorm(IDRTlme) This gives the output: How can I add a…
Caledonian26
  • 727
  • 1
  • 10
  • 27
2
votes
1 answer

R Tidyverse Group by and count of nulls for all columns

I found similar questions but can't quite find one that answers my question: I am trying to find, by location, how often people are entering data for ~ 100 parameters. This question almost answers it. But how do I add a group_by line, so it is more…
Gingie
  • 129
  • 1
  • 7
2
votes
3 answers

Create column with labels from labelled data

I have a data set with labelled data and would like to create a new column containing only the label as character. Consider the following example: value_labels <- tibble(value = 1:6, labels = paste0("value", 1:6)) df_data <- tibble(id = 1:10, var =…
Ivo
  • 3,890
  • 5
  • 22
  • 53
2
votes
1 answer

Create dissimilarity matrix from data.frame with three columns

This data.frame contains the dissimilarity y between two communities comm1 and comm2. I would like to convert it to a dissimilarity matrix of type dist. library(tidyverse) library(RcppAlgos) k<-10…
Filipe Dias
  • 284
  • 1
  • 10
2
votes
2 answers

What is the meaning of : Warning in do.call(.f, args, envir = .env) : "what" must be a function or character string

This is the exact message: Warning in do.call(.f, args, envir = .env) : 'what' must be a function or character string Working in an Azure Databricks environment for data processing using R, spark and the tidyverse. This message appears even when…
2
votes
3 answers

Removing values prior to some specific index rowwise

I currently have data which looks like the following: ID Var_1 Var_2 Var_3 Var_4 Var_5 RemovePrior 1 20 30 25 35 40 3 2 40 50 45 55 60 2 3 60 70 65 75 80 4 4 80 90 85 95 85 5 df <- data.frame(ID = c(1, 2, 3, 4), …
tmako
  • 349
  • 2
  • 9
2
votes
1 answer

Filtering list column with value in other column

I am trying to filter a nested dataframe/list column with the value contained in another column of the main (?) dataframe. Unfortunately, my code below doesn't work, and I think the problem is that the way I am referring to search_term inside the…
zoowalk
  • 2,018
  • 20
  • 33
2
votes
2 answers

Automate univariate regressions for many outcomes in tbl_uvregression (gtsummary), return formatted results in R

I would like to use tbl_uvregression function (gtsummary package, R) because it can create univariate regression models holding either a covariate or outcome constant. In my case, For each outcome, I need one nicely formatted table of univariate…
Nelly
  • 373
  • 2
  • 11
2
votes
3 answers

custom function to handle different date formats from excel trying to use curly curly

I have a dataframe imported from excel with read_excel that looks like this: The main task is to handle the different formats of dates: I would like to implement it into a custom function (and I am not good at all in creating functions): df <-…
TarJae
  • 72,363
  • 6
  • 19
  • 66
2
votes
3 answers

count nonzero values in each column tidyverse

I have a df with a bunch of sites and a bunch of variables. I need to count the number of non-zero values for each site. I feel like I should be able to do this with summarize() and count() or tally(), but can't quite figure it out. reprex: df <- …
Jake L
  • 987
  • 9
  • 21