add column value based on row index r code example
Example: add column value based on row index r
# We can use row_number() function in dplyr
# We will test if the row is present in your vector and assign the value accordingly
library(dplyr)
sig = c(5, 10, 20)
genes %>%
mutate(Sig = ifelse(row_number() %in% sig, "YES", "NO"))