getting an error when trying to plot graphs

hello! still pretty new at R and i keep getting this error no matter what graph i try to do? just keeps reappearing alot :frowning: this is the code where this shows up:Error in f():
! stat_bin() can only have an x or y aesthetic.

ggplot(students , aes(x=Medu,y=G1)) + geom_line()+ geom_point() + labs(title="Relationship between Mothers Education and First Year Grades",x="Mother's Education", y="First Period Grade")+
  theme_minimal() + scale_color_brewer(palette="Pastel1")

this is the sample data that i am trying to use for the code im getting an error in:
where for Medu it would be the mothers education where (numeric: 0 - none, 1 - primary education (4th grade), 2 – 5th to 9th grade, 3 – secondary education or 4 – higher education) and for G1 it would be first period grade (numeric: from 0 to 20)

V8 = c("Medu", "4","1","1","4","3","4","2"),
V32 = c("G1", "5","5","7","15","6","15", "12")

although when i do insert this code it still works? although for the colour change part it doesnt work....

ggplot (students , aes(x=famsize,y=G1)) + geom_jitter() + labs(title="Relationship between the Family Size and First Year Grades",x="Family Size", y="First Period Grade")+
  theme_minimal() + scale_color_brewer(palette="Pastel1")
V7 = c("Pstatus", "A", "T", "T", "T", "T", "T", "T"),
V32 = c("G1", "5", "5", "7", "15", "6", "15", "12")

this is the sample data that i used where i didnt get an error in where famsize is family size (binary: 'LE3' - less or equal to 3 or 'GT3' - greater than 3).

Hello.
Thanks for providing code , but you could take further steps to make it more convenient for other forum users to help you.

Share some representative data that will enable your code to run and show the problematic behaviour.

You might use tools such as the library datapasta, or the base function dput() to share a portion of data in code form, i.e. that can be copied from forum and pasted to R session.

Reprex Guide

I appreciate the response and the feedback and will do! Thanks for explaining on how to share the data, really helped! I will try to input that data above.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.