R language — commonly used but always unforgettable data processing tips

Time:2022-5-7

##Extract elements in the list that contain specific characters

DE.pattern = your_list[grep(pattern = “pattern”,x = names(your_list),value = T)]

##Batch read file names in the list

library(pipeR)

library(rlist)

test = list.files(path = “E:/Desktop/”,pattern = “*” )

write.table(test,”E:/Desktop/readme.xls”,sep = “\t”)

###Read all sheets in Excel

library(readxl)

excel_ Path < – C (“your path / Annex 1 MRM quantitative analysis results of plant hormones – 1 read. Xlsx”)

data = list()

for (i in 1:length(excel_sheets(excel_path))) {

  data[[i]] = read_xlsx(path = excel_path,sheet = i)

}

names(data) = excel_sheets(excel_path)

###Replace inf / Na / 0 in the data

yourdata[yourdata==Inf]<-NA

###Remove all rows with value line 0 when drawing the heat map

data_figure = data_figure[which(rowSums(data_figure)>0),]