使用“ Cookbook for R”中的功能汇总data.frame仅输出NA / NaN(ggplot中的误差条需要)

时间:2019-01-31 14:07:32

标签: r ggplot2 plyr

我用ggplot创建了一个线图。现在,我想将95%置信区间添加到数据点。在寻找解决方法时,我从"Cookbook for R"找到了函数“ SummarySE”,并尝试将其应用于我的数据。

我遇到的问题是,所有新的计算列仅包含带有Warning message: In qt(conf.interval/2 + 0.5, datac$N - 1) : NaNs produced的NA和NaN。

我得到的输出的

head()How the head of my output looks like

我的数据:

structure(list(J01 = structure(c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 
8L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 
8L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 
8L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 
8L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 
8L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 
8L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L), .Label = c("Tetrazykline", 
"Penicilline", "Andere Beta-Lactame", "Sulfonamide & Trimethoprim", 
"Makrolide, Lincosamide & Streptogramine", "Aminoglykoside", 
"Chinolone", "Andere Antibiotika"), class = "factor"), Monat = structure(c(1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 
3L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 5L, 
5L, 5L, 5L, 5L, 5L, 5L, 5L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 7L, 
7L, 7L, 7L, 7L, 7L, 7L, 7L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 9L, 
9L, 9L, 9L, 9L, 9L, 9L, 9L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 
10L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 12L, 12L, 12L, 12L, 
12L, 12L, 12L, 12L), .Label = c("Jan 2018", "Feb 2018", "Mär 2018", 
"Apr 2018", "Mai 2018", "Jun 2018", "Jul 2018", "Aug 2018", "Sep 2018", 
"Okt 2018", "Nov 2018", "Dez 2018"), class = "factor"), DDDs = c(262, 
5729, 3305, 495, 588, 153, 944, 922, 85, 6386, 3157, 546, 753, 
120, 421, 419, 102, 6758, 3582, 682, 853, 167, 884, 1061, 122, 
5628, 3395, 564, 520, 161, 501, 728, 208, 4976, 3380, 508, 620, 
205, 704, 1106, 147, 4420, 3521, 634, 611, 110, 728, 1212, 133, 
5717, 3783, 708, 582, 230, 593, 842, 387, 6191, 3796, 605, 410, 
62, 595, 875, 130, 5309, 4084, 2010, 395, 163, 632, 1202, 84, 
5266, 3437, 617, 568, 141, 623, 948, 60, 5972, 3485, 718, 518, 
132, 588, 1034, 182, 4924, 3360, 573, 405, 96, 319, 1337)), row.names = c(NA, 
-96L), class = "data.frame")

现在有人有什么问题吗,我该如何解决?

0 个答案:

没有答案