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
R 泊松分布的多重图_R_Ggplot2 - Fatal编程技术网

R 泊松分布的多重图

R 泊松分布的多重图,r,ggplot2,R,Ggplot2,我有很多不同的变量: df_poisson <- structure(list(V1 = c(131L, 38L, 19L, 96L, 13L, 34L), V2 = c(1L, 1L, 1L, 1L, 0L, 1L), V3 = c(104L, 30L, 20L, 72L, 21L, 62L), V4 = c(20L, 12L, 7L, 14L, 7L, 18L), V5 = c(38L, 9L, 12L, 31L, 10L, 18L), V6 = c(2L

我有很多不同的变量:

df_poisson <- structure(list(V1 = c(131L, 38L, 19L, 96L, 13L, 34L), 
    V2 = c(1L, 1L, 1L, 1L, 0L, 1L), V3 = c(104L, 
    30L, 20L, 72L, 21L, 62L), V4 = c(20L, 12L, 7L, 
    14L, 7L, 18L), V5 = c(38L, 9L, 12L, 31L, 10L, 18L), V6 = c(2L, 
    0L, 1L, 2L, 0L, 7L), V7 = c(293L, 87L, 44L, 217L, 
    46L, 156L), V8 = c(1L, 0L, 0L, 0L, 0L, 0L), V9 = c(0L, 
    1L, 0L, 0L, 0L, 0L), V10 = c(1L, 1L, 1L, 0L, 0L, 
    1L), V11 = c(1L, 1L, 1L, 1L, 1L, 1L), V11 = c(1L, 
    1L, 1L, 1L, 0L, 1L), V13 = c(4L, 1L, 1L, 0L, 0L, 2L), 
    V14 = c(0L, 0L, 0L, 0L, 0L, 0L), V15 = c(0L, 
    0L, 0L, 0L, 0L, 0L), V16 = c(0L, 0L, 0L, 0L, 0L, 0L), 
    V17 = c(0L, 0L, 0L, 0L, 0L, 0L)), .Names = c("V1", 
"V2", "V3", "V4", "V5", "V6", 
"V7", "V8", "V9", "V10", "V11", 
"V12", "V13", "V14", "V15", "V16", 
"V17"), row.names = c(NA, 6L), class = "data.frame")

df_poisson我们需要首先为
df_poisson
中的变量生成
poisson
分布。比如:

#poisson distribution for all columns
df_poisson <- lapply(df_poisson, function(x)ppois(x,1)) %>% as.data.frame()

不清楚您要寻找的是哪种类型的绘图。你能详细说明你想要的图的类型吗?我不知道“泊松图”可能是什么,更不用说有17个图的图可能是什么样子了。
  library(tidyverse)

  df_poisson %>%
    mutate(x = row_number()) %>%
    gather(key, value, -x) %>%
    ggplot(aes(x, value, color = key)) +
    geom_line()