View source: R/aided_chatgpt.R
na.cumsum | R Documentation |
This function calculates the cumulative sum of a numeric vector, removing any 'NA' values before computation.
na.cumsum(x)
x |
A numeric vector for which the cumulative sum is to be calculated. |
A numeric vector representing the cumulative sum with 'NA' values removed. Returns an empty vector if the input is empty or contains only 'NA' values.
# Example with numeric vector
numeric_vector <- c(1, 2, NA, 4, 5)
na.cumsum(numeric_vector)
# Example with all NAs
na.cumsum(c(NA, NA))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.