Changing specific column values based on conditions in R

I have following dataframe named ‘Saty’ in R One_Day Arrived_Date Departure_Date Yes 2022-01-10 NA No 2021-05-12 2021-06-01 Yes 2021-12-01 2021-12-01 Yes 2022-03-01 NA I want to modify the dataframe, if the One_Day column value is ‘Yes’, my ‘Arrived_Date’ and ‘Departure_Date’ should be same, like below dataframe. One_Day Arrived_Date Departure_Date Yes 2022-01-10 2022-01-10 No 2021-05-12 2021-06-01… Read More Changing specific column values based on conditions in R

R: Calculate percentage of observations in a column that are below a certain value for panel data

I have panel data and I would like to get the percentage of observations in a column (Size) that are below 1 million. My data is the following: structure(list(Product = c("A", "A", "A", "A", "A", "A", "B", "B", "B", "B", "B", "B", "C", "C", "C", "C", "C", "C"), Date = c("02.05.2018", "04.05.2018", "05.05.2018", "06.05.2018", "07.05.2018",… Read More R: Calculate percentage of observations in a column that are below a certain value for panel data

How to use dplyr to return the grouped sum of all numeric columns when there are NA values?

I’m was attempting to sum all numeric columns using dplyr’s group_by and summarise functions as below. I didn’t understand the error returned from the summarise function and cannot seem to find a similar example on stack overflow … however after two members pointed out my error in making the example data I found that the… Read More How to use dplyr to return the grouped sum of all numeric columns when there are NA values?

Web-Scraping using R (I want to extract some table like data from a website)

I’m having some problems scraping data from a website. I do have not a lot of experience with web-scraping. My intended plan is to scrape some data using R from the following website: https://www.myfxbook.com/forex-broker-swaps More precisely, I want to extract the Forex Brokers Swap Comparison for all the available pairs. My idea so far: library(XML)… Read More Web-Scraping using R (I want to extract some table like data from a website)

Join columns, duplicating existing row for each variable in new column

Ok so say we have two different columns of data. One is just a running date column: day 2017-11-08 2017-11-09 2017-11-10 2017-11-13 2017-11-14 2017-11-15 The other is just an ID column ID asdflauih3298b43f9n akjwn3ibfun9834n93n nv43879n4vliuhs87ba I would like to join these columns in a way so that each ID occurs for every day. Like this:… Read More Join columns, duplicating existing row for each variable in new column