Open mhorger opened 5 years ago
Looks like a few different issues here.
bust<-c(bust)
This would would work:
bust <- 1 # define bust
bust <- c(bust) # assign bust into itself
num <- 0
dollar <- 0
if (sample(1:6,1) == 3){
num <- num+1
dollar <- dollar +1
} else{
num <- num+1
}
a. Your original code had if (sample(1:6) ==3)
. The sample(1:6)
part produces a vector of 6 numbers (random orders of numbers from 1 to 6). You are then conducting a logical comparison between 6 numbers and one number, which will cause an error message. If you want to randomly pick a number between 1 to 6 and then test to see if it is a three try if( sample(1:6,1) ==3 )
b. I wasn't sure what you were trying to do on line 607...but if you were just trying to add 1 to the num and dollar variables, then my suggested code above does that.
I keep getting an error message on these lines of code and it doesn't matter if I delete the text- the error remains. It will stop a code from running even if it runs fine after I enter down a few lines. When I try to knit the page or build the website, it never completes the action and I believe it is because of this error. Has anyone else encountered this?