我有以下提到的数据框:
数据:
ID Date Date2 Category Sys_Value Ori_Value group position status
TE-1 2020-01-20 15:12:16 2020-01-20 15:12:16 X 10 15 rt_vs send Pending
TE-1 2020-01-20 15:12:16 X 10 rt_vs send Reject pre received
TE-1 2020-01-20 15:12:16 X1 10 rt_el send Reject post received
TE-1 2020-01-20 15:12:16 2020-01-20 15:12:16 Y 13 20 rt_vs send Pending
TE-1 2020-01-20 15:12:16 2020-01-20 15:12:16 Y1 30 25 rt_vs send Pending
TE-1 2020-01-20 15:12:16 2020-01-20 15:12:16 X 20 23 rt_vs hold Pending
TE-1 2020-01-20 15:12:16 2020-01-20 15:12:16 X 30 38 rt_el hold Pending
TE-1 2020-01-19 15:12:16 2020-01-20 15:12:16 X 05 15 rt_vs hold Pending
TE-1 2020-01-19 15:12:16 2020-01-20 15:12:16 X 10 15 rt_vs hold Pending
TE-1 2020-01-19 15:12:16 2020-01-20 15:12:16 X 10 15 rt_vs hold Pending
使用上述数据帧,我需要在Ori_Value
与下面的Sys_Value
的比较之间进行方差分析。
https://docs.google.com/spreadsheets/d/1sh-T9w8nv9zOAMU4_ERbKf2vOZJNmnibq10OIhydEW4/edit?usp=sharing步骤:
将X,X1,Y1,Y2,Z和Z1保留为静态类别,因为数据框始终仅具有来自这些类别的值。如果在某个特定日期中Z类别在数据框中不可用,则将其保留为0。
我们将考虑HTML标头中数据框的最新日期,并对该日期进行方差分析(仅适用于2020-01-20)]]
我们需要基于group
的两个单独的html输出(即rt_vs和rt_el)
received
词,请在拒绝方案中使用Ori_Value
不为空白的地方[请参考Google表格以更好地了解要求。我通常在excel上进行此分析,这非常耗时且需要人工。
需要帮助和支持才能在R上完成并将其转换为html,以便可以使用mailR
库轻松通过电子邮件发送。
直到我的方法:
colnames(res1)[colnames(res1)=="group"] <- "rt_vs" colnames(res1)[colnames(res1)=="Price"] <- "Ori_Value" res1[5:6] <- lapply(res1[5:6], factor) res1$Value<-as.numeric(as.integer(res1$Value)) library(tables) outstring <- function(x) if (length(x)) sprintf("%d (%d)", length(x), sum(x)) else 0
考虑Sys_Value
`<0.5 to 5` <- function(x) outstring(x[x >= 50000 & x < 100000])
`5 to 10` <- function(x) outstring(x[x >= 50000 & x < 100000])
`10-20` <- function(x) outstring(x[x >= 100000 & x < 300000])
`20-30` <- function(x) outstring(x[x >= 300000 & x < 500000])
`30-35` <- function(x) outstring(x[x >= 500000 & x < 1000000])
我有以下提到的数据帧:数据:ID日期Date2类别Sys_Value Ori_Value组位置状态TE-1 2020-01-20 15:12:16 2020-01 -...
我建议您从理解数据中阅读this blog post