How to add column with altered ID-names for duplicates within same day

I have a data frame with Days, ID, Date collected and a count value (number of hatched eggs) for several samples each day. The ID stems from the replicate (mother) from which the sample (a number of eggs) was taken, so it requires the information from the "Date collected" column in order to distinguish them… Read More How to add column with altered ID-names for duplicates within same day

adding a new column to a datframe for 3 condition cases

I have a dataframe like this: geneID baseMean log2FoldChange lfcSE stat pvalue padj ENSG00000000003.14 2700.791337 -0.345466785 0.202389477 -1.706940451 0.087833121 0.001 ENSG00000000419.12 1571.143316 -0.348258736 0.150807514 -2.309293001 0.020927328 0.120478416 ENSG00000000457.13 526.2282051 -0.051250213 0.180482116 -0.283962835 0.776438862 0.003 ENSG00000000460.16 1108.138705 -0.078538637 0.167859597 -0.467882913 0.639868323 0.827329552 ENSG00000001036.13 2662.132047 0.121419414 0.175209898 0.692994033 0.488313296 0.728842774 ENSG00000001084.10 1325.447272 0.89 0.154875429 -0.423289781 0.672083849 0.0004… Read More adding a new column to a datframe for 3 condition cases

Count the number of timestamps in a given vector that fall within an interval in R

I want to count the number of events that occur within intervals. I start with a table that has three columns: start dates, end dates, and the interval created by them. table <- tibble( start = c( "2022-08-02", "2022-10-06", "2023-01-11"), end = c("2022-08-04", "2023-02-06", "2023-02-04"), interval = start %–% end ) I also have a… Read More Count the number of timestamps in a given vector that fall within an interval in R

In R, how do I make a long dataset that contains all the categories that a row applies to?

I have a dataset of students, and I want to create a column that categorizes each student based on their and other students’ data in their "subject" and "grade_letter" column because I eventually want to create a column that says "math_science_A", "science_B", etc. to know how many students got As, Bs, Cs, etc. based on… Read More In R, how do I make a long dataset that contains all the categories that a row applies to?

Difference from the mean by column

I’ve got this DF: structure(list(Date = structure(c(18605, 18604, 18598, 18597, 18590, 18584, 18583, 18578, 18570, 18569, 18563, 18562, 18557, 18549, 18548, 18542, 18541, 18536, 18534, 18529, 18521, 18520, 18515, 18508, 18500, 18499, 18493, 18492, 18486, 18485, 18479, 18478, 18472, 18471, 18465, 18464, 18458, 18457, 18450, 18445, 18444, 18437, 18436, 18430, 18429, 18424, 18416, 18415, 18410,… Read More Difference from the mean by column

Mutating a column of grouped data with a value from a column based on a specific timestamp from another column

I am looking for an efficient way to replicate a process below, for example using dplyr. Suppose I have this df: df <- data.frame(id = c("A", "A", "A", "A", "A", "A", "A", "A"), date = as.Date(c("2022-01-01", "2022-01-01", "2022-01-01", "2022-01-01", "2022-01-02", "2022-01-02", "2022-01-02", "2022-01-02")), timestamp = c("08:59:00", "09:00:00", "09:01:00", "09:02:00", "08:59:00", "09:00:00", "09:01:00", "09:02:00"), result =… Read More Mutating a column of grouped data with a value from a column based on a specific timestamp from another column