Skip to main content

All Questions

Tagged with
1 vote
2 answers
63 views

getting the latest date for a a duplicated item in r [closed]

I have the following dataset (below). I am trying to get the latest SEnd value for each individual tag (see Desired output) where I have the Tag, Owner and the latest SEnd date only. Essentially I am ...
pat's user avatar
  • 105
0 votes
2 answers
43 views

How can i filter rows by one condition (id) which are repeated in two days

i have a df, which containing 4 columns: microbiological data (mo), sample_date, and patient id (pid_code), id (for each rows). Its looks like this: id mo sample_date pid_code 1 Staphylococcus ...
Pendrine's user avatar
1 vote
1 answer
38 views

Calculating running amounts with uneven number of dates

I have a table full of dates and reply-to times for technical support tickets, and I'd like to calculate a running rate to find the average reply time over the previous n number of days. The data is ...
user23687835's user avatar
0 votes
3 answers
81 views

Combining mutate, across, and as_date('yyyymmdd') results in all NA

I'm trying to combine mutate, across, and as_date, including the format argument in as_date. This is resulting in all NA values, as shown below. library(tidyverse) library(tis) holidays(2023) %>% ...
Abe's user avatar
  • 413
0 votes
0 answers
23 views

How to add row corresponding to Date and other weather variables? [duplicate]

The sample dataset is as below: Date Gender temp number of admission 16/11/2023 F 10 degree celsius 12 17/11/2023 M 12 degree celsius 20 17/11/2023 F 12 degree celsius 12 My expected outcome is: ...
doraemon's user avatar
  • 786
0 votes
1 answer
19 views

Find Overlap in Dates Between Multiple Date Columns in the Same DF

I have a df as below where each column (v1-v10) is a unique set of dates from 10 other data frames containing various data. I want to find the date range/ranges in which all columns (v1-v10) share. ...
Eizy's user avatar
  • 317
0 votes
2 answers
68 views

Aligning data from multiple years across 24 months in R

I have a dataset with observations of ids during certain months. Here is a minimal data set example: data <- structure(list(id = c(11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, ...
vheim's user avatar
  • 43
0 votes
1 answer
58 views

How to convert day-of-year to month, day-of-month with tidyverse

There are a number of queries on similar date-conversion problems using as.Date() and tidyverse / lubridate functions, but I am getting the wrong answers for my problem, and can't figure out why. My ...
user101089's user avatar
  • 3,842
-2 votes
1 answer
267 views

converting chr (mm/dd/yyyy) to date with lubridate in r

I have a column called date, chr class, format mm/dd/yyyy. I have tried converting it to date with lubridate as follows: df$date<- df %>% as.Date(date) df$date<- df %>% as_date(date) ...
Lillian Welsh's user avatar
0 votes
1 answer
115 views

Calculate the lagged differences between consecutive dates in vectors

The sample dataset is given as below: v = data.frame(group = c(1,1,2,3,3),date = as.Date(c('01-01-2000','01-01-2001','01-05-2000','02-07-2000','01-01-2008'), "%d-%m-%Y")) v%>% group_by(...
doraemon's user avatar
  • 786
0 votes
3 answers
67 views

How can I create a column containing the date and time of a whole year in a dataset in R?

I have a dataset of 61,368 rows with data from 2015 to 2021, each row is one hour of one day of the year. Here is an example of the table Site_1 Site_2 Year 1 5 2015 3 9 2015 2 7 2015 5 3 2015 0 ...
Josh's user avatar
  • 37
1 vote
1 answer
58 views

Group by different date ranges in R?

If I have data set with daily data, how I can I group_by a custom set of date ranges? The below screen grab details the of the date ranges I'd like to group by. Any help would be greatly appreciated. ...
tpscp's user avatar
  • 49
2 votes
2 answers
61 views

How to determine difference in days between two dates across two columns and two rows by group?

I am looking to determine the difference in days by groups across two columns and two rows. Essentially subtract from the End Day by the subsequent Start Day in the subsequent row and record the ...
emp88's user avatar
  • 31
0 votes
1 answer
212 views

Create interval of dates for my existing data in R

I am trying to get my existing observations to 10 min intervals in R. I did this: data3$date= ceiling_date(as.POSIXct(data3$betdate), unit = "10 minutes") data3 %>% group_by(date, prov) %...
Emiliano Barone's user avatar
0 votes
3 answers
2k views

How do I change a ymd date to a dmy date with lubridate?

So, let's say I have data with a column date. library(dplyr) library(lubridate) df <- data.frame( nr = c(1, 2), date = c(20170131, 20081028) ) df2 <- df %>% mutate(date = ymd(date)) ...
Nina van Bruggen's user avatar

15 30 50 per page
1
2 3 4 5
7