library(tidyverse)
# Toy data
df <- tibble(
name = c("A", "B", "C"),
id = c(123, 456, 789),
age = c(20, 22, 30)
)
# Apply filtering
df %>%
filter(age > 35)
#> # A tibble: 0 x 3
#> # ... with 3 variables: name <chr>, id <dbl>, age <dbl>
When I apply the filtering filter(age > 35), there is no data for obvious reasons. In this situation, how can I create a data frame where name and id get "" and the age column gets "Nothing to check".
The data frame, say, df_wanted should look like this:
# A tibble: 1 x 3
name id age
<chr> <chr> <chr>
1 "" "" Nothing to check