Last active
April 12, 2018 20:27
-
-
Save erzk/9a360692db54e9f1bdacbe29e7dd3743 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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