Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用R中的矩阵制作分组条形图_R_Matrix_Vector_Bar Chart - Fatal编程技术网

使用R中的矩阵制作分组条形图

使用R中的矩阵制作分组条形图,r,matrix,vector,bar-chart,R,Matrix,Vector,Bar Chart,我正在尝试使用矩阵形式的数字类型数据制作分组条形图。我从中提取的数据帧将数据存储为字符串,因此我还需要将数据转换为数字类型 制作向量 wt250如果需要快速修复,请更换矩阵创建: m <- matrix(c(wt250, wt50, wt10), nrow=3, ncol=4, byrow = TRUE) m m <- matrix(c(wt250, wt50, wt10), nrow=4, ncol=3) mat <- matrix(1:12, nrow = 4, nco

我正在尝试使用矩阵形式的数字类型数据制作分组条形图。我从中提取的数据帧将数据存储为字符串,因此我还需要将数据转换为数字类型

制作向量
wt250如果需要快速修复,请更换矩阵创建:

m <- matrix(c(wt250, wt50, wt10), nrow=3, ncol=4, byrow = TRUE)
m
m <- matrix(c(wt250, wt50, wt10), nrow=4, ncol=3)
mat <- matrix(1:12, nrow = 4, ncol = 3)
colnames(mat) <- letters[1:3]
rownames(mat) <- letters[23:26]

barplot(mat,col = c("red", "blue", "cyan", "orange"), beside = TRUE)