my_df <- dplyr::tibble(x = -100:100, y = x + 5) # solution my_df$cumsum_x <- cumsum(my_df$x) # solution my_sol <- sum(my_df$cumsum_x > -3500)
my_answers <- make_random_answers(my_sol) #check_answers(my_answers)
Create a new column in object my_df
called cumsum_x
, containing the cumulative sum of x
(cumsum
function). In this new column, how many values are greater than -3500?
#exams::answerlist(my_answers, markup = "markdown")
extype: num
exsolution: r my_sol
exname: "dataframe basic 02"
exshuffle: TRUE
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.