# define a function | |
replace_nth_ETG4000 <- function(x, mark) { | |
x <- x %>% group_by(Mark) %>% mutate(Count = row_number()) %>% data.frame() | |
double_marks <- which(x$Mark == mark & x$Count %% 2 == 0) | |
x$Mark[double_marks] <- 0 | |
x <- subset(x, select = -Count) | |
return(x) | |
} | |
# remove second occurrence of Mark 2 | |
df2 <- replace_nth_ETG4000(df, 2) | |
df2 <- replace_nth_ETG4000(df2, 2) | |
# reassign block borders | |
block_borders <- which(df2$Mark == 2) | |
# plot | |
plot(df2$CH1.703.6., type = "l", ylab = "Intensity") | |
abline(v = block_borders, col = "blue") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment