Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

week07_solutions - sim( ) maybe broken of behaving unexpected #8

Open
Jailos opened this issue May 3, 2023 · 0 comments
Open

week07_solutions - sim( ) maybe broken of behaving unexpected #8

Jailos opened this issue May 3, 2023 · 0 comments

Comments

@Jailos
Copy link

Jailos commented May 3, 2023

The code chunk below gives an error that may be pointing to the in bold below. When run, it breaks and gives the error listed later.

pU0 <- sapply( 1:61 ,
function(dist)
sim(m4,vars=c("Ks","C"),data=list(A=Asim,U=rep(1,n),D=rep(dist,n)))$C
)

Error in if (left == var) { : the condition has length > 1

When I tried to debug it, the error may be coming from the sim() function in the line in bold below... I might be wrong, but not able to fix it either. Or maybe I missed the whole point, actually.

sim_vars <- list()
for (var in vars) {
f <- fit@formula[[1]]
for (i in 1:length(fit@formula)) {
f <- fit@formula[[i]]
left <- as.character(f[[2]])
if (left == var) {
if (debug == TRUE)
print(f)
break

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant