Centralize the matrix for heatmap
This codes come from Trinity-rnaseq
Exm_center <- function(primary_data){ primary_data = as.matrix(primary_data) ##transformations data = log2(primary_data+1) data = as.matrix(data) # convert to matrix ## Centering rows data = data.frame(t(scale(t(data), scale=F))) return (data) }
String
remove numbers from str
string_with_numbers <- "The quick brown fox 123 jumps over the lazy dog 456" string_without_numbers <- gsub("\\d+", "", string_with_numbers) print(string_without_numbers)
[1] "The quick brown fox jumps over the lazy dog "
In this example, string_with_numbers is the original string that contains numbers. The \d+ regular expression matches one or more digits, and the gsub() function replaces all matches with an empty string. The resulting string without numbers is stored in string_without_numbers. Who said this?