I am working with ggplot to display box plot with multiple variables and I used select method and this error appear so how to resolve this issue
library(dplyr)
p <- df
select(heart[,1],
trestbps,
chol,
thalach,
oldpeak,
ca,
target)
gather(key = "key",
value = "value",
-target)
ggplot(aes(y = value)) +
geom_boxplot(aes(fill = target),
alpha = .6,
fatten = .7) +
labs(x = "",
y = "",
title = "Boxplots for Numeric Variables") +
scale_fill_manual(
values = c("#fde725ff", "#20a486ff"),
name = "Heart\nDisease",
labels = c("No HD", "Yes HD")) +
theme(
axis.text.x = element_blank(),
axis.ticks.x = element_blank()) +
facet_wrap(~ key,
scales = "free",
ncol = 2)
plot(p)
Error in UseMethod("select_") : no applicable method for 'select_' applied to an object of class "c('integer', 'numeric')"