Search
 
SCRIPT & CODE EXAMPLE
 

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"))
Comment

PREVIOUS NEXT
Code Example
R :: changing base group in factor in r 
R :: SSL certificate problem in R 
R :: r select column names starting with 
R :: sumif in r 
R :: change the font of the title in a plot in r 
R :: how to add in R dictionary 
R :: grep string that ends with R 
R :: ggplot box plot without outliers poins 
Rust :: rust get command line arguments 
Rust :: rust vec cannot move 
Rust :: rust sum vector 
Rust :: assert rust 
Rust :: string to bytes rust 
Rust :: rust file extension 
Rust :: rust String to &str 
Rust :: split rust 
Rust :: transpose a matrix 
Rust :: rust string interpolation 
Rust :: armanriazi•rust•error•E0277•the size for values of type `str` cannot be known at compilation time 
Rust :: set interval Rust 
Rust :: armanriazi•rust•error•E0615•attempted to take value of method `collect` on type 
Rust :: char is digit rust 
Rust :: reverse a string with runes 
Lua :: luau make a rainbow part 
Lua :: if part is touched 
Lua :: os.date lua 
Lua :: dictionnary lua 
Lua :: lua infinite 
Lua :: table.find lua 
Lua :: convert number to string lua 
ADD CONTENT
Topic
Content
Source link
Name
9+9 =