Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR R

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"))
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #add #column #based #row #index
ADD COMMENT
Topic
Name
8+3 =