When running my R code I get the errors: Error in t == group_1_survtimes[1] : comparison (1) is possible only for atomic and list types
and
Error: unexpected '}' in "}"
neither of which I know how to fix. Is someone able to identify what the problem is?
N = "group_1"
P = "group_2"
group = c(rep(N,13), rep(P,20))
survival = c(23,47,69,70,71,100,101,148,181,198,208,212,224,5,8,10,13,18,
24,26,31,35,50,59,
61,76,109,116,118,143,154,162,225)
df = data.frame("group" = group, "survival" = survival)
group_1_survtimes = df[1:13,2]
Y_1 = c(rep(length(group_1_survtimes),tail(group_1_survtimes,n = 1)))
for (t in 1: tail(group_1_survtimes, n = 1 ) {
if (t == group_1_survtimes[1]) {
Y_1[-t] = Y_1[-t] - 1
group_1_survtimes = group_1_survtimes[-1]
}
}
)
on thefor
line. – G. Grothendieckdf
andt
as your variable names. But those names are names of the functionst()
anddf()
in R. Just for readability, and in order to avoid the problems in a code, I, personally, would choose other names. – utubun