Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/67.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
GGR中GGR图的for循环中的数学符号_R_Ggplot2_Expression - Fatal编程技术网

GGR中GGR图的for循环中的数学符号

GGR中GGR图的for循环中的数学符号,r,ggplot2,expression,R,Ggplot2,Expression,我目前正在尝试开发一个类似的结果。对于x轴,我有大量的列和几个不同的标签 col1 <- c(2, 4, 1, 2, 5, 1, 2, 0, 1, 4, 4, 3, 5, 2, 4, 3, 3, 6, 5, 3, 6, 4, 3, 4, 4, 3, 4, 2, 4, 3, 3, 5, 3, 5, 5, 0, 0, 3, 3, 6, 5, 4, 4, 1, 3, 3, 2, 0, 5, 3, 6, 6, 2, 3, 3, 1, 5, 3, 4, 6

我目前正在尝试开发一个类似的结果。对于x轴,我有大量的列和几个不同的标签

col1 <- c(2, 4, 1, 2, 5, 1, 2, 0, 1, 4, 4, 3, 5, 2, 4, 3, 3, 6, 5, 3, 6, 4, 3, 4, 4, 3, 4, 
          2, 4, 3, 3, 5, 3, 5, 5, 0, 0, 3, 3, 6, 5, 4, 4, 1, 3, 3, 2, 0, 5, 3, 6, 6, 2, 3, 
          3, 1, 5, 3, 4, 6)
col2 <- c(2, 4, 4, 0, 4, 4, 4, 4, 1, 4, 4, 3, 5, 0, 4, 5, 3, 6, 5, 3, 6, 4, 4, 2, 4, 4, 4, 
          1, 1, 2, 2, 3, 3, 5, 0, 3, 4, 2, 4, 5, 5, 4, 4, 2, 3, 5, 2, 6, 5, 2, 4, 6, 3, 3, 
          3, 1, 4, 3, 5, 4)
col3 <- c(2, 5, 4, 1, 4, 2, 3, 0, 1, 3, 4, 2, 5, 1, 4, 3, 4, 6, 3, 4, 6, 4, 1, 3, 5, 4, 3, 
          2, 1, 3, 2, 2, 2, 4, 0, 1, 4, 4, 3, 5, 3, 2, 5, 2, 3, 3, 4, 2, 4, 2, 4, 5, 1, 3, 
          3, 3, 4, 3, 5, 4)
col4 <- c(2, 5, 2, 1, 4, 1, 3, 4, 1, 3, 5, 2, 4, 3, 5, 3, 4, 6, 3, 4, 6, 4, 3, 2, 5, 5, 4,
          2, 3, 2, 2, 3, 3, 4, 0, 1, 4, 3, 3, 5, 4, 4, 4, 3, 3, 5, 4, 3, 5, 3, 6, 6, 4, 2, 
          3, 3, 4, 4, 4, 6)
data2 <- data.frame(col1,col2,col3,col4)
data2[,1:4] <- lapply(data2[,1:4], as.factor)
colnames(data2)<- c("A","B","C", "D")

> x.axis.list

[[1]]
expression(beta[paste(1, ",", 1L)])

[[2]]
expression(beta[paste(1, ",", 2L)])

[[3]]
expression(beta[paste(1, ",", 3L)])

[[4]]
expression(beta[paste(1, ",", 4L)])

myplots <- vector('list', ncol(data2))

for (i in seq_along(data2)) {
    message(i)
    myplots[[i]] <- local({
        i <- i
        p1 <- ggplot(data2, aes(x = data2[[i]])) +
            geom_histogram(fill = "lightgreen") +
            xlab(x.axis.list[[i]])
        print(p1)
    })
}
col1您可以执行以下操作:

for(沿(数据2)顺序排列的i){
df您可以执行以下操作:

for(沿(数据2)顺序排列的i){

df我不太确定你想要什么,你能完全按照你想要的写一个x轴标签吗?我添加了一个更新的示例输出。我不明白为什么“表达式”打印在打印轴上。当我在表达式列表中循环时,问题似乎出现了。当我放入一个表达式时,我可以得到我想要的输出,不幸的是,我想为几个打印更新轴。我不完全确定你想要什么,你能完全按照你想要的写一个x轴标签吗?我添加了一个更新的examp我不明白为什么“表达式”打印在绘图轴上。当我循环遍历表达式列表时,问题似乎出现了。当我放入一个表达式时,我可以得到我想要的输出,不幸的是,我想为几个绘图更新轴。如何翻转数字?因此,在
x.axis.list@AW27中的1之前设置
I
,您可以执行
解析(text=paste0(“beta[paste(,i,,,,,,,,,,,,,”,1)])
如何翻转数字?因此,在
x.axis.list@AW27中的1之前有
i
,你可以进行
解析(text=paste0(“beta[paste(,i,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,”,1)])