r - 使用“Cookbook for R”中的函数汇总 data.frame 仅输出 NA / NaN(ggplot 中的误差线需要)
问题描述
我用 ggplot 创建了一个线图。现在我想将 95% 置信区间添加到数据点。在寻找一种方法时,我从“Cookbook for R”中找到了函数“SummarySE”,并尝试将其应用于我的数据。
我遇到的问题是,所有新的计算列仅包含 NA 和 NaN 以及Warning message: In qt(conf.interval/2 + 0.5, datac$N - 1) : NaNs produced
.
我的数据:
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")
有人现在有什么问题以及我该如何解决?
解决方案
推荐阅读
- c++ - 带有 std::map 对象的类和已删除的复制赋值和构造函数导致 C2280 带有 std::pair 的复制构造函数
- python - 如何在烧瓶应用程序中仅针对 Web 服务器运行启动代码,而不针对烧瓶命令?
- batch-file - 使用批处理的第一列中的值重命名 CSV 文件
- javascript - 为什么 JSON 输出中的某些字段缺少引号以及为什么输出中没有双引号
- fullcalendar - FullCalendar v4.4 在使用 eventRender 时在元素中给出未定义
- process - 在 Wayland 上,今天有没有办法获取当前关注的窗口标题和进程 ID?
- javascript - 如何添加自定义控件以在我的播放器中添加下一个/上一个曲目按钮 - JSON?
- python - 在不存在预先指定的条件的情况下插入 pandas 数据帧
- javascript - “别名”类型上不存在属性“forEach”
- ios - EarlGrey 2 - 白盒设置模拟器在测试运行时崩溃