Category "tidyverse"

select(column, (contains()) not showing results

chase_2021 = chase[c(143:1020),] paychecks = chase_2021 %>% select(Posting.Date, Amount, Description, starts_with('CVS'), ends_with('PPD ID: 995338

Change column name with tq_get() in Tidyquant

I'm using the tq_get() function in Tidyquant to retrieve economic data from FRED: library(tidyquant) library(tidyverse) consumer_price_index <- 'CPIAUCSL'

How to filter out rows that do not fit specified condition in R [duplicate]

I have this data frame: df <- data.frame (ID = c(1:20), Ethnicity = c(rep(c("White", "Asian", "Black", "Hispanic", "Othe

Count number of rows that fulfill multiple conditions in R

I have a dataframe: df <- data.frame (ID = c(1:20), Ethnicity = c(rep(c("White", "Asian", "Black", "Hispanic", "Other"), times=20/5)),

Mutate variable conditional on first unique occurance of another variable

I want to create a variable which identifies the first occurance of a variable in a column but I cannot seem to get the code to work. The new varibale should on

How to insert rows in specific indices of dataframe containing sum of few rows above only in R pipe dplyr

for dataframe below, df <- data.frame(id = c(rep(101, 4), rep(202, 3)), status = c("a","b","c","d", "a", "b", "c"), wt = c(10

Counting observations by 30-days window

As I explained in previous posts I'm trying to count observations over 30 days windows grouping by id. The data: df<-structure(list(id=c(1,1,1,2),date=c("200

How can I filter rows out if their start date is within 90 days from today and place them out until the 1st of the following month in R?

I am having difficulty finding the words to describe what I am searching for but will try. I would like to solve the following using R or Python (but preferably

Data Frame- Add number of occurrences with a condition in R

I'm having a bit of a struggle trying to figure out how to do the following. I want to map how many days of high sales I have previously a change of price. For

How to split negative and positive bars by zero line in barplot?

My data have 2 numerical columns (positive and negative values) and 2 categorical variables. Now I want to plot negative and positive bars on same line, instead

How to read dirty csv file in R?

I have a very dirty data that I need to read in R. The csv file seperated with comma, but there are also some commas in the first column of my data that puts me

app$vspace error in building phylogenetic tree in R

I am working with phylogenetic trees. Import the phylogenetic tree file with ggtree::read.tree and get the information with readxl::read_xlsx. I want to visuali

How to apply slope plot R code to another data

I have dataframe which represents sales by model within 2 different years. 'change' column stands for absolute change by models from 2020 to 2021 while 'chng.pe

Creating custom Quantiles within data frame?

If i have the following table: tibble(year = c("2020", "2020", "2020","2021", "2021", "2021"), website = c("facebook", "google", "youtube","facebook", "

dplyr: Replace multiple values based on condition in a selection of columns

I try to conditionally replace multiple values in a data frame. In the following data set, I want to replace in columns 3:5 all values of 2 by "X" and all value

How can I install tidyverse on Archlinux?

I'm running since a few days archlinux and installed R-Studio today. I'm not able to install the tidyverse packages. Error in library(tidyverse) : there is no p

Dynamic `case_when` that allows for different number of conditions and conditions itself

I'm looking for a dynamic way to specify some "condition parameters" and then feed that to a case_when operation or something else if better suited for that pro

A better way to write dplyr pipes? (without using dollar sign) [closed]

Quite often when using the tidyverse to manipulate data, I come up with a situation like the one below. Can someone explain why option 3 works

tidyverse: data transformation, gather()

I am trying to transform a dataset: [1]: https://i.stack.imgur.com/09Ioo.png To something like this: [2]: https://i.stack.imgur.com/vKKu2.png How can I do this

Conditional mutate - creating a new variable with coalesce

I'm scraping data from a website and depending on the structure of the page. I have an inner join in my final table that either joins clean on WON and LOST vari