我想遍历表列的值以找到一个值。如果找到了值,我想插入与找到的值关联的行的副本。
第一个循环创建一个空白行并编辑一个列值。 第二个循环应将数据直接粘贴到每个新创建的空白行上方,并粘贴到其下方的空白行中。
抛出错误的行:
starters$Total_testscore_f <- cut(starters$Total_testscore, breaks = c(0,5,10,13,16))
s <- with(mydata, summary(as.numeric(Percentage_f) ~ Gender + SE_track + Total_testscore_f, fun=sf))
glm(I(as.numeric(Percentage_f) >= 2) ~ Gender + SE_track + Total_testscore_f, family = "binomial", data = mydata)
glm(I(as.numeric(Percentage_f) >= 3) ~ Gender + SE_track + Total_testscore_f, family = "binomial", data = mydata)
glm(I(as.numeric(Percentage_f) >= 4) ~ Gender + SE_track + Total_testscore_f, family = "binomial", data = mydata)
s[, 4] <- s[, 4] - s[, 3]
s[, 3] <- s[, 3] - s[, 3]
s
# plot
par(mfrow = c(1,1))
plot(s, which=1:3, pch=1:3, xlab='logit', main=' ', xlim = c(-3,0))#xlim=range(s[,3:4]))
# suggesting that the proportional odds assumption may not hold
as.numeric(Percentage_f) N= 286 , 2 Missing
+-----------------+-------+---+----+----+---------+
| | |N |Y>=1|Y>=2|Y>=3 |
+-----------------+-------+---+----+----+---------+
|Gender |male | 97|Inf |0 |-2.454782|
| |female |189|Inf |0 |-2.356815|
+-----------------+-------+---+----+----+---------+
|SE_track |KSO | 39|Inf |0 |-2.419256|
| |TSO | 40|Inf |0 |-2.465489|
| |ASO |207|Inf |0 |-2.458155|
+-----------------+-------+---+----+----+---------+
|Total_testscore_f|(0,5] | 25|Inf |0 |-1.912387|
| |(5,10] |153|Inf |0 |-2.956124|
| |(10,13]| 81|Inf |0 |-2.096264|
| |(13,16]| 27|Inf |0 |-2.151035|
+-----------------+-------+---+----+----+---------+
|Overall | |286|Inf |0 |-2.380934|
+-----------------+-------+---+----+----+---------+
ws.Range("ws.Cells(Y, 1): ws.Cells(Y, 8)").Value