I want to combine rows of character column descrb
condition on the value of namefn
.
df1 <-
structure(list(namefn = c(".checkMFClasses", "", "AIC", "ARMAacf",
"ARMAtoMA", "Beta"), descrb = c("Functions to Check the Type of Variables passed",
"to Model Frames", "Akaike's An Information Criterion", "Compute Theoretical ACF for an ARMA Process",
"Convert ARMA Process to Infinite MA Process", "The Beta Distribution"
)), row.names = c(NA, 6L), class = "data.frame")
df1
namefn descrb
1 .checkMFClasses Functions to Check the Type of Variables passed
2 to Model Frames
3 AIC Akaike's An Information Criterion
4 ARMAacf Compute Theoretical ACF for an ARMA Process
5 ARMAtoMA Convert ARMA Process to Infinite MA Process
6 Beta The Beta Distribution
Required Output
namefn descrb
1 .checkMFClasses Functions to Check the Type of Variables passed to Model Frames
2 AIC Akaike's An Information Criterion
3 ARMAacf Compute Theoretical ACF for an ARMA Process
4 ARMAtoMA Convert ARMA Process to Infinite MA Process
5 Beta The Beta Distribution
I tried the following code
library(tidyverse)
df1 %>%
mutate(descrb = if_else(namefn == "", "Merge", descrb))