Phylum$Phylum - factorrownamesPhylum levels = revrownamesPhylumPhylumt-meltPhylumidvars=Phylum详细解释每个代码
-
Phylum$Phylum: This selects the "Phylum" column from the "Phylum" data frame. The dollar sign$is used to select a specific column from a data frame. -
factor(rownames(Phylum), levels = rev(rownames(Phylum))): This creates a factor variable from the row names of the "Phylum" data frame. A factor variable is a categorical variable in R. Thelevelsargument specifies the order of the levels in the factor. In this case, the levels are reversed using therevfunction. -
Phylum.t: This creates a new data frame called "Phylum.t". -
melt(Phylum, id.vars='Phylum'): This "melts" the "Phylum" data frame, which means it converts it from wide format to long format. Theid.varsargument specifies which column(s) should be used as the identifier variables in the long format. In this case, "Phylum" is used as the identifier variable. The result is a data frame with three columns: "Phylum" (the identifier variable), "variable" (which contains the names of the columns in the original data frame), and "value" (which contains the values from the original data frame)
原文地址: https://www.cveoy.top/t/topic/faBD 著作权归作者所有。请勿转载和采集!