Adjust the following R code so it removes the output circled in red.

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Adjust the following R code so it removes the output circled in red.

Post by answerhappygod »

Adjust the following R code so it removes the output circled in
red.
Adjust The Following R Code So It Removes The Output Circled In Red 1
Adjust The Following R Code So It Removes The Output Circled In Red 1 (28.17 KiB) Viewed 18 times
***{r} set. seed (0) waiting_guests <- function(lambda, guests, hours) { # null vector vec vec <- c() # initialize values as in the code current_guests <- 0 remaining_guests <- 0 # while loop with condition hours != 0 while (hours != 0) { # update values current_guests <- remaining_guests + rpois (1, lambda) remaining_guests <- max( current_guests print (paste(current_guests, guests, 0) remaining_guests)) vec <-c(vec, remaining_guests) #update hours hours < hours-1; } # return the vector return (vec) } answer <- waiting_guests (3,4,8) print (answer) [1] "5 1" [1] "30" [1] "20" [1] "30" [1] "5 1" [1] "30" [1] "5 1" 11 "7 3" [1] 1 0 0 0 1 0 1 3
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply