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)

Question

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")

Solution


Meta-information

extype: num exsolution: r my_sol exname: "dataframe basic 02" exshuffle: TRUE



msperlin/afedR documentation built on Sept. 11, 2022, 9:49 a.m.