I'm fairly certain that your age and fare variables are not numeric before mutate(). I'm able to generate the plot just fine after casting them to the proper data type.
Here is the whole reprex.
library(dplyr, warn.conflicts = FALSE)
library(rpart)
library(rpart.plot)
path <- 'https://raw.githubusercontent.com/guru99-edu/R-Programming/master/titanic_data.csv'
titanic <- read.csv(path, stringsAsFactors = FALSE)
titanic %>%
select(age, fare) %>%
glimpse()
#> Rows: 1,309
#> Columns: 2
#> $ age <chr> "29", "0.9167", "2", "30", "25", "48", "63", "39", "53", "71",...
#> $ fare <chr> "211.3375", "151.55", "151.55", "151.55", "151.55", "26.55", "...
clean_titanic <- titanic %>%
select(-home.dest, -cabin, -name, -x, -ticket) %>%
mutate(pclass = factor(pclass, levels = c(1, 2, 3), labels = c('Upper', 'Middle', 'Lower')),
survived = factor(survived, levels = c(0, 1), labels = c('No', 'Yes')),
age = as.numeric(age),
fare = as.numeric(fare))
#> Warning: NAs introduced by coercion
#> Warning: NAs introduced by coercion
clean_titanic %>%
select(age, fare) %>%
glimpse()
#> Rows: 1,309
#> Columns: 2
#> $ age <dbl> 29.0000, 0.9167, 2.0000, 30.0000, 25.0000, 48.0000, 63.0000, 3...
#> $ fare <dbl> 211.3375, 151.5500, 151.5500, 151.5500, 151.5500, 26.5500, 77....
fit <- rpart(survived ~ ., data = clean_titanic, method = 'class')
rpart.plot(fit)

Created on 2020-04-10 by the reprex package (v0.3.0)
Note: I forgot to mention that I also added stringsAsFactors = FALSE to your read.csv() call. But even without this parameter, your age and fare variables would be read in as factors; not numeric (due to the presence of "?" in some rows).