本文介绍了R中的3维数组名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在3维数组下面:
ar <- array(someData, c(5, 5, 5)); rownames(ar) <- ...; #to set up row names colnames(ar) <- ...; #to set up col names如何设置三维尺寸名称?
How can i set the third dimension names ?
推荐答案您可以在定义数组时设置dimnames参数:
You can either set the dimnames argument when defining the array:
ar <- array(data = 1:27, dim = c(3, 3, 3), dimnames = list(c("a", "b", "c"), c("d", "e", "f"), c("g", "h", "i")))和/或您可以像这样设置第三维的dimnames:
and/or you can set the dimnames of the third dimension like so:
dimnames(ar)[[3]] <- c("G", "H", "I")更多推荐
R中的3维数组名称
发布评论