Hi, I'm trying to plot a categorical variable, the code works if i plot all categories and separate them by color. this is fine but it is not what I want. Instead, i want to isolate the categories such that the plot only shows points of a single category. i have set my aesthetics individualy because i want to have various plots from the same data on a single canvas so that i can do comparison. the code gives me an error as shown below.
ggplot(data) + geom_point(aes(x= A[gender == "male"],y = B [gender == "male"])) +
geom_smooth(aes (x= A[gender == "female"],y = B [gender == "female"]), method= 'lm' , se = F)
Error: Must subset columns with a valid subscript vector.
i Logical subscripts must match the size of the indexed input.
x Input has size 12 but subscript
gender == "male" has size 1296.
rlang::last_error() to see where the error occurred